Java 11 migrate remaining p (#1122)
* Moves partial-response to Java 11 * Moves pipeline to Java 11 * Moves poison-pill to Java 11 * Moves priority-queue to Java 11 * Moves private-class-data to Java 11 * Moves producer-consumer to Java 11 * Moves promise to Java 11 * Moves property to Java 11 * Moves prototype to Java 11 * Moves proxy to Java 11 * Corrects checkstyle errors * Fixes build for pipeline pattern
This commit is contained in:
committed by
Ilkka Seppälä
parent
1401accb4f
commit
428efc7d53
@ -81,8 +81,8 @@ public class AlbumListPage extends Page {
|
||||
*/
|
||||
public AlbumPage selectAlbum(String albumTitle) {
|
||||
// uses XPath to find list of html anchor tags with the class album in it
|
||||
List<HtmlAnchor> albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
|
||||
for (HtmlAnchor anchor : albumLinks) {
|
||||
var albumLinks = (List<HtmlAnchor>) page.getByXPath("//tr[@class='album']//a");
|
||||
for (var anchor : albumLinks) {
|
||||
if (anchor.getTextContent().equals(albumTitle)) {
|
||||
try {
|
||||
anchor.click();
|
||||
|
@ -25,7 +25,6 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlNumberInput;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlOption;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
|
||||
@ -85,7 +84,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage changeAlbumTitle(String albumTitle) {
|
||||
HtmlTextInput albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
|
||||
var albumTitleInputTextField = (HtmlTextInput) page.getElementById("albumTitle");
|
||||
albumTitleInputTextField.setText(albumTitle);
|
||||
return this;
|
||||
}
|
||||
@ -98,7 +97,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage changeArtist(String artist) {
|
||||
HtmlTextInput artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
|
||||
var artistInputTextField = (HtmlTextInput) page.getElementById("albumArtist");
|
||||
artistInputTextField.setText(artist);
|
||||
return this;
|
||||
}
|
||||
@ -111,8 +110,8 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage changeAlbumYear(int year) {
|
||||
HtmlSelect albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
|
||||
HtmlOption yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
|
||||
var albumYearSelectOption = (HtmlSelect) page.getElementById("albumYear");
|
||||
var yearOption = albumYearSelectOption.getOptionByValue(Integer.toString(year));
|
||||
albumYearSelectOption.setSelectedAttribute(yearOption, true);
|
||||
return this;
|
||||
}
|
||||
@ -125,7 +124,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage changeAlbumRating(String albumRating) {
|
||||
HtmlTextInput albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
|
||||
var albumRatingInputTextField = (HtmlTextInput) page.getElementById("albumRating");
|
||||
albumRatingInputTextField.setText(albumRating);
|
||||
return this;
|
||||
}
|
||||
@ -137,8 +136,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
|
||||
HtmlNumberInput numberOfSongsNumberField =
|
||||
(HtmlNumberInput) page.getElementById("numberOfSongs");
|
||||
var numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
|
||||
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
|
||||
return this;
|
||||
}
|
||||
@ -150,7 +148,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumListPage}
|
||||
*/
|
||||
public AlbumListPage cancelChanges() {
|
||||
HtmlSubmitInput cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
|
||||
var cancelButton = (HtmlSubmitInput) page.getElementById("cancelButton");
|
||||
try {
|
||||
cancelButton.click();
|
||||
} catch (IOException e) {
|
||||
@ -166,7 +164,7 @@ public class AlbumPage extends Page {
|
||||
* @return {@link AlbumPage}
|
||||
*/
|
||||
public AlbumPage saveChanges() {
|
||||
HtmlSubmitInput saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
|
||||
var saveButton = (HtmlSubmitInput) page.getElementById("saveButton");
|
||||
try {
|
||||
saveButton.click();
|
||||
} catch (IOException e) {
|
||||
|
@ -82,7 +82,7 @@ public class LoginPage extends Page {
|
||||
* @return {@link LoginPage}
|
||||
*/
|
||||
public LoginPage enterUsername(String username) {
|
||||
HtmlTextInput usernameInputTextField = (HtmlTextInput) page.getElementById("username");
|
||||
var usernameInputTextField = (HtmlTextInput) page.getElementById("username");
|
||||
usernameInputTextField.setText(username);
|
||||
return this;
|
||||
}
|
||||
@ -95,8 +95,7 @@ public class LoginPage extends Page {
|
||||
* @return {@link LoginPage}
|
||||
*/
|
||||
public LoginPage enterPassword(String password) {
|
||||
HtmlPasswordInput passwordInputPasswordField =
|
||||
(HtmlPasswordInput) page.getElementById("password");
|
||||
var passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
|
||||
passwordInputPasswordField.setText(password);
|
||||
return this;
|
||||
}
|
||||
@ -109,7 +108,7 @@ public class LoginPage extends Page {
|
||||
* logged in
|
||||
*/
|
||||
public AlbumListPage login() {
|
||||
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
|
||||
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
|
||||
try {
|
||||
loginButton.click();
|
||||
} catch (IOException e) {
|
||||
|
@ -23,14 +23,12 @@
|
||||
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.AlbumListPage;
|
||||
import com.iluwatar.pageobject.AlbumPage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Album Selection and Album Listing
|
||||
*/
|
||||
@ -45,7 +43,7 @@ public class AlbumListPageTest {
|
||||
|
||||
@Test
|
||||
public void testSelectAlbum() {
|
||||
AlbumPage albumPage = albumListPage.selectAlbum("21");
|
||||
var albumPage = albumListPage.selectAlbum("21");
|
||||
albumPage.navigateToPage();
|
||||
assertTrue(albumPage.isAt());
|
||||
}
|
||||
|
@ -25,11 +25,10 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
|
||||
/**
|
||||
* Test Album Page Operations
|
||||
*/
|
||||
@ -45,7 +44,7 @@ public class AlbumPageTest {
|
||||
@Test
|
||||
public void testSaveAlbum() {
|
||||
|
||||
AlbumPage albumPageAfterChanges = albumPage
|
||||
var albumPageAfterChanges = albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
@ -59,7 +58,7 @@ public class AlbumPageTest {
|
||||
|
||||
@Test
|
||||
public void testCancelChanges() {
|
||||
AlbumListPage albumListPage = albumPage.cancelChanges();
|
||||
var albumListPage = albumPage.cancelChanges();
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
@ -25,11 +25,10 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
|
||||
/**
|
||||
* Test Login Page Object
|
||||
*/
|
||||
@ -44,7 +43,7 @@ public class LoginPageTest {
|
||||
|
||||
@Test
|
||||
public void testLogin() {
|
||||
AlbumListPage albumListPage = loginPage
|
||||
var albumListPage = loginPage
|
||||
.enterUsername("admin")
|
||||
.enterPassword("password")
|
||||
.login();
|
||||
|
Reference in New Issue
Block a user