mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-22 08:23:59 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
+7
-11
@@ -27,17 +27,6 @@
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
@@ -49,6 +38,13 @@
|
||||
<module>sample-application</module>
|
||||
<module>test-automation</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -32,5 +32,15 @@
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<artifactId>sample-application</artifactId>
|
||||
</project>
|
||||
|
||||
@@ -52,8 +52,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public final class App {
|
||||
|
||||
private App() {
|
||||
}
|
||||
private App() {}
|
||||
|
||||
/**
|
||||
* Application entry point
|
||||
@@ -85,6 +84,5 @@ public final class App {
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("An error occurred.", ex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public final class App {
|
||||
|
||||
private App() {
|
||||
}
|
||||
private App() {}
|
||||
|
||||
/**
|
||||
* Application entry point
|
||||
@@ -84,6 +83,5 @@ public final class App {
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,14 +26,12 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumListPage;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Album Selection and Album Listing
|
||||
*/
|
||||
/** Test Album Selection and Album Listing */
|
||||
class AlbumListPageTest {
|
||||
|
||||
private final AlbumListPage albumListPage = new AlbumListPage(new WebClient());
|
||||
@@ -49,5 +47,4 @@ class AlbumListPageTest {
|
||||
albumPage.navigateToPage();
|
||||
assertTrue(albumPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,12 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.AlbumPage;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Album Page Operations
|
||||
*/
|
||||
/** Test Album Page Operations */
|
||||
class AlbumPageTest {
|
||||
|
||||
private final AlbumPage albumPage = new AlbumPage(new WebClient());
|
||||
@@ -46,16 +44,16 @@ class AlbumPageTest {
|
||||
@Test
|
||||
void testSaveAlbum() {
|
||||
|
||||
var albumPageAfterChanges = albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
.changeAlbumRating("B")
|
||||
.changeNumberOfSongs(20)
|
||||
.saveChanges();
|
||||
var albumPageAfterChanges =
|
||||
albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
.changeAlbumRating("B")
|
||||
.changeNumberOfSongs(20)
|
||||
.saveChanges();
|
||||
|
||||
assertTrue(albumPageAfterChanges.isAt());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -64,5 +62,4 @@ class AlbumPageTest {
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,12 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.htmlunit.WebClient;
|
||||
import com.iluwatar.pageobject.pages.LoginPage;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Login Page Object
|
||||
*/
|
||||
/** Test Login Page Object */
|
||||
class LoginPageTest {
|
||||
|
||||
private final LoginPage loginPage = new LoginPage(new WebClient());
|
||||
@@ -45,12 +43,8 @@ class LoginPageTest {
|
||||
|
||||
@Test
|
||||
void testLogin() {
|
||||
var albumListPage = loginPage
|
||||
.enterUsername("admin")
|
||||
.enterPassword("password")
|
||||
.login();
|
||||
var albumListPage = loginPage.enterUsername("admin").enterPassword("password").login();
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,15 +24,13 @@
|
||||
*/
|
||||
package com.iluwatar.pageobject.pages;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.htmlunit.html.HtmlAnchor;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Album List page (album-list.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Album List page (album-list.html) */
|
||||
public class AlbumListPage extends Page {
|
||||
|
||||
private static final String ALBUM_LIST_HTML_FILE = "album-list.html";
|
||||
@@ -40,15 +38,11 @@ public class AlbumListPage extends Page {
|
||||
|
||||
private HtmlPage page;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
/** Constructor */
|
||||
public AlbumListPage(WebClient webClient) {
|
||||
super(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to the Album List Page
|
||||
*
|
||||
@@ -63,9 +57,7 @@ public class AlbumListPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Album List".equals(page.getTitleText());
|
||||
@@ -92,6 +84,4 @@ public class AlbumListPage extends Page {
|
||||
}
|
||||
throw new IllegalArgumentException("No links with the album title: " + albumTitle);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -24,18 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.pageobject.pages;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.htmlunit.html.HtmlNumberInput;
|
||||
import org.htmlunit.html.HtmlOption;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
import org.htmlunit.html.HtmlSelect;
|
||||
import org.htmlunit.html.HtmlSubmitInput;
|
||||
import org.htmlunit.html.HtmlTextInput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Album Page (album-page.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Album Page (album-page.html) */
|
||||
public class AlbumPage extends Page {
|
||||
|
||||
private static final String ALBUM_PAGE_HTML_FILE = "album-page.html";
|
||||
@@ -43,15 +40,11 @@ public class AlbumPage extends Page {
|
||||
|
||||
private HtmlPage page;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
/** Constructor */
|
||||
public AlbumPage(WebClient webClient) {
|
||||
super(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to the album page
|
||||
*
|
||||
@@ -66,16 +59,12 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Album Page".equals(page.getTitleText());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the album title input text field
|
||||
*
|
||||
@@ -88,7 +77,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the artist input text field
|
||||
*
|
||||
@@ -101,7 +89,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects the select's option value based on the year value given
|
||||
*
|
||||
@@ -115,7 +102,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the album rating input text field
|
||||
*
|
||||
@@ -140,7 +126,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel changes made by clicking the cancel button
|
||||
*
|
||||
@@ -156,7 +141,6 @@ public class AlbumPage extends Page {
|
||||
return new AlbumListPage(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves changes made by clicking the save button
|
||||
*
|
||||
@@ -171,5 +155,4 @@ public class AlbumPage extends Page {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,16 +24,14 @@
|
||||
*/
|
||||
package com.iluwatar.pageobject.pages;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.htmlunit.WebClient;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
import org.htmlunit.html.HtmlPasswordInput;
|
||||
import org.htmlunit.html.HtmlSubmitInput;
|
||||
import org.htmlunit.html.HtmlTextInput;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Login Page (login.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Login Page (login.html) */
|
||||
public class LoginPage extends Page {
|
||||
|
||||
private static final String LOGIN_PAGE_HTML_FILE = "login.html";
|
||||
@@ -64,15 +62,12 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Login".equals(page.getTitleText());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enters the username into the username input text field
|
||||
*
|
||||
@@ -85,7 +80,6 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enters the password into the password input password field
|
||||
*
|
||||
@@ -98,7 +92,6 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clicking on the login button to 'login'
|
||||
*
|
||||
@@ -114,5 +107,4 @@ public class LoginPage extends Page {
|
||||
}
|
||||
return new AlbumListPage(webClient);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,10 @@ package com.iluwatar.pageobject.pages;
|
||||
|
||||
import org.htmlunit.WebClient;
|
||||
|
||||
/**
|
||||
* Encapsulation for a generic 'Page'
|
||||
*/
|
||||
/** Encapsulation for a generic 'Page' */
|
||||
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/";
|
||||
|
||||
protected final WebClient webClient;
|
||||
@@ -53,6 +49,4 @@ public abstract class Page {
|
||||
* @return true if so, otherwise false
|
||||
*/
|
||||
public abstract boolean isAt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,9 +34,17 @@
|
||||
</parent>
|
||||
<artifactId>test-automation</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+3
-13
@@ -31,9 +31,7 @@ import org.htmlunit.WebClient;
|
||||
import org.htmlunit.html.HtmlAnchor;
|
||||
import org.htmlunit.html.HtmlPage;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Album List page (album-list.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Album List page (album-list.html) */
|
||||
@Slf4j
|
||||
public class AlbumListPage extends Page {
|
||||
private static final String ALBUM_LIST_HTML_FILE = "album-list.html";
|
||||
@@ -41,15 +39,11 @@ public class AlbumListPage extends Page {
|
||||
|
||||
private HtmlPage page;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
/** Constructor. */
|
||||
public AlbumListPage(WebClient webClient) {
|
||||
super(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to the Album List Page.
|
||||
*
|
||||
@@ -64,9 +58,7 @@ public class AlbumListPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Album List".equals(page.getTitleText());
|
||||
@@ -93,6 +85,4 @@ public class AlbumListPage extends Page {
|
||||
}
|
||||
throw new IllegalArgumentException("No links with the album title: " + albumTitle);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ import org.htmlunit.html.HtmlSelect;
|
||||
import org.htmlunit.html.HtmlSubmitInput;
|
||||
import org.htmlunit.html.HtmlTextInput;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Album Page (album-page.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Album Page (album-page.html) */
|
||||
@Slf4j
|
||||
public class AlbumPage extends Page {
|
||||
private static final String ALBUM_PAGE_HTML_FILE = "album-page.html";
|
||||
@@ -43,15 +41,11 @@ public class AlbumPage extends Page {
|
||||
|
||||
private HtmlPage page;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
/** Constructor. */
|
||||
public AlbumPage(WebClient webClient) {
|
||||
super(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Navigates to the album page.
|
||||
*
|
||||
@@ -66,16 +60,12 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Album Page".equals(page.getTitleText());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the album title input text field.
|
||||
*
|
||||
@@ -88,7 +78,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the artist input text field.
|
||||
*
|
||||
@@ -101,7 +90,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects the select's option value based on the year value given.
|
||||
*
|
||||
@@ -115,7 +103,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the album rating input text field.
|
||||
*
|
||||
@@ -140,7 +127,6 @@ public class AlbumPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancel changes made by clicking the cancel button.
|
||||
*
|
||||
@@ -156,7 +142,6 @@ public class AlbumPage extends Page {
|
||||
return new AlbumListPage(webClient);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves changes made by clicking the save button.
|
||||
*
|
||||
@@ -171,5 +156,4 @@ public class AlbumPage extends Page {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,7 @@ import org.htmlunit.html.HtmlPasswordInput;
|
||||
import org.htmlunit.html.HtmlSubmitInput;
|
||||
import org.htmlunit.html.HtmlTextInput;
|
||||
|
||||
/**
|
||||
* Page Object encapsulating the Login Page (login.html)
|
||||
*/
|
||||
/** Page Object encapsulating the Login Page (login.html) */
|
||||
@Slf4j
|
||||
public class LoginPage extends Page {
|
||||
private static final String LOGIN_PAGE_HTML_FILE = "login.html";
|
||||
@@ -65,15 +63,12 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean isAt() {
|
||||
return "Login".equals(page.getTitleText());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enters the username into the username input text field.
|
||||
*
|
||||
@@ -86,7 +81,6 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enters the password into the password input password field.
|
||||
*
|
||||
@@ -99,7 +93,6 @@ public class LoginPage extends Page {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clicking on the login button to 'login'.
|
||||
*
|
||||
@@ -115,5 +108,4 @@ public class LoginPage extends Page {
|
||||
}
|
||||
return new AlbumListPage(webClient);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,14 +26,10 @@ package com.iluwatar.pageobject;
|
||||
|
||||
import org.htmlunit.WebClient;
|
||||
|
||||
/**
|
||||
* Encapsulation for a generic 'Page'.
|
||||
*/
|
||||
/** Encapsulation for a generic 'Page'. */
|
||||
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 = "../sample-application/src/main/resources/sample-ui/";
|
||||
|
||||
protected final WebClient webClient;
|
||||
@@ -53,6 +49,4 @@ public abstract class Page {
|
||||
* @return true if so, otherwise false
|
||||
*/
|
||||
public abstract boolean isAt();
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-4
@@ -30,9 +30,7 @@ import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Album Selection and Album Listing
|
||||
*/
|
||||
/** Test Album Selection and Album Listing */
|
||||
class AlbumListPageTest {
|
||||
|
||||
private final AlbumListPage albumListPage = new AlbumListPage(new WebClient());
|
||||
@@ -48,5 +46,4 @@ class AlbumListPageTest {
|
||||
albumPage.navigateToPage();
|
||||
assertTrue(albumPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
-12
@@ -30,9 +30,7 @@ import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Album Page Operations
|
||||
*/
|
||||
/** Test Album Page Operations */
|
||||
class AlbumPageTest {
|
||||
|
||||
private final AlbumPage albumPage = new AlbumPage(new WebClient());
|
||||
@@ -45,16 +43,16 @@ class AlbumPageTest {
|
||||
@Test
|
||||
void testSaveAlbum() {
|
||||
|
||||
var albumPageAfterChanges = albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
.changeAlbumRating("B")
|
||||
.changeNumberOfSongs(20)
|
||||
.saveChanges();
|
||||
var albumPageAfterChanges =
|
||||
albumPage
|
||||
.changeAlbumTitle("25")
|
||||
.changeArtist("Adele Laurie Blue Adkins")
|
||||
.changeAlbumYear(2015)
|
||||
.changeAlbumRating("B")
|
||||
.changeNumberOfSongs(20)
|
||||
.saveChanges();
|
||||
|
||||
assertTrue(albumPageAfterChanges.isAt());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,5 +61,4 @@ class AlbumPageTest {
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-8
@@ -30,9 +30,7 @@ import org.htmlunit.WebClient;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test Login Page Object
|
||||
*/
|
||||
/** Test Login Page Object */
|
||||
class LoginPageTest {
|
||||
|
||||
private final LoginPage loginPage = new LoginPage(new WebClient());
|
||||
@@ -44,12 +42,8 @@ class LoginPageTest {
|
||||
|
||||
@Test
|
||||
void testLogin() {
|
||||
var albumListPage = loginPage
|
||||
.enterUsername("admin")
|
||||
.enterPassword("password")
|
||||
.login();
|
||||
var albumListPage = loginPage.enterUsername("admin").enterPassword("password").login();
|
||||
albumListPage.navigateToPage();
|
||||
assertTrue(albumListPage.isAt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user