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
@ -67,8 +67,8 @@ public final class App {
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
File applicationFile =
|
||||
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
|
||||
var classLoader = App.class.getClassLoader();
|
||||
var applicationFile = new File(classLoader.getResource("sample-ui/login.html").getPath());
|
||||
|
||||
// Should work for unix like OS (mac, unix etc...)
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.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 +45,7 @@ public class AlbumListPageTest {
|
||||
|
||||
@Test
|
||||
public void testSelectAlbum() {
|
||||
AlbumPage albumPage = albumListPage.selectAlbum("21");
|
||||
var albumPage = albumListPage.selectAlbum("21");
|
||||
albumPage.navigateToPage();
|
||||
assertTrue(albumPage.isAt());
|
||||
}
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.AlbumPage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Album Page Operations
|
||||
*/
|
||||
@ -46,7 +46,7 @@ public class AlbumPageTest {
|
||||
@Test
|
||||
public void testSaveAlbum() {
|
||||
|
||||
AlbumPage albumPageAfterChanges = albumPage
|
||||
var albumPageAfterChanges = albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
@ -60,7 +60,7 @@ public class AlbumPageTest {
|
||||
|
||||
@Test
|
||||
public void testCancelChanges() {
|
||||
AlbumListPage albumListPage = albumPage.cancelChanges();
|
||||
var albumListPage = albumPage.cancelChanges();
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import com.iluwatar.pageobject.pages.LoginPage;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Test Login Page Object
|
||||
*/
|
||||
@ -45,7 +45,7 @@ public class LoginPageTest {
|
||||
|
||||
@Test
|
||||
public void testLogin() {
|
||||
AlbumListPage albumListPage = loginPage
|
||||
var albumListPage = loginPage
|
||||
.enterUsername("admin")
|
||||
.enterPassword("password")
|
||||
.login();
|
||||
|
@ -26,7 +26,6 @@ package com.iluwatar.pageobject.pages;
|
||||
import com.gargoylesoftware.htmlunit.WebClient;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@ -79,8 +78,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();
|
||||
|
@ -30,7 +30,6 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlSelect;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
|
||||
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@ -83,7 +82,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;
|
||||
}
|
||||
@ -96,7 +95,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;
|
||||
}
|
||||
@ -109,8 +108,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;
|
||||
}
|
||||
@ -123,7 +122,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;
|
||||
}
|
||||
@ -135,7 +134,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;
|
||||
}
|
||||
@ -147,7 +146,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) {
|
||||
@ -163,7 +162,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) {
|
||||
|
@ -79,7 +79,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;
|
||||
}
|
||||
@ -92,7 +92,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;
|
||||
}
|
||||
@ -101,11 +101,11 @@ public class LoginPage extends Page {
|
||||
/**
|
||||
* Clicking on the login button to 'login'
|
||||
*
|
||||
* @return {@link AlbumListPage}
|
||||
* - this is the page that user gets navigated to once successfully logged in
|
||||
* @return {@link AlbumListPage} - this is the page that user gets navigated to once successfully
|
||||
* logged in
|
||||
*/
|
||||
public AlbumListPage login() {
|
||||
HtmlSubmitInput loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
|
||||
var loginButton = (HtmlSubmitInput) page.getElementById("loginButton");
|
||||
try {
|
||||
loginButton.click();
|
||||
} catch (IOException e) {
|
||||
|
@ -31,8 +31,7 @@ import com.gargoylesoftware.htmlunit.WebClient;
|
||||
public abstract class Page {
|
||||
|
||||
/**
|
||||
* Application Under Test path
|
||||
* This directory location is where html web pages are located
|
||||
* Application Under Test path This directory location is where html web pages are located
|
||||
*/
|
||||
public static final String AUT_PATH = "src/main/resources/sample-ui/";
|
||||
|
||||
|
Reference in New Issue
Block a user