Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge #1

Merged
merged 201 commits into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
0c6237c
Type object pattern #555 (#848)
AnaghaSasikumar Jul 24, 2019
17bfc91
Change Travis CI build env. to Trusty (#911)
ptrax Jul 28, 2019
c6ecf58
508 : sonar qube critical issue fixes (#852)
kanwarpreet25 Jul 28, 2019
f7e22a1
508 : Sonar qube critical Issue Fix (#854)
kanwarpreet25 Jul 28, 2019
a113de6
Add licenses
iluwatar Jul 28, 2019
d9a567c
Commander pattern #505 (#857)
AnaghaSasikumar Jul 29, 2019
2757b21
Best practice when compare enum (#869)
hoangnam2261 Jul 29, 2019
aaabc8f
Fix the dependency conflict issue (#872)
HelloCoCooo Jul 29, 2019
b497d41
Modify Observer pattern UML (#877)
dRadest Jul 29, 2019
3454941
Typo coresponding -> corresponding (#879)
pierDipi Jul 29, 2019
36e80c4
fixed failing tests (#860) (#880)
id4us Jul 29, 2019
517c209
Added one more Credit/Article about the benefits of Repository patter…
tomrlh Jul 29, 2019
6daaeec
Remove the transitive dependency(junit-jupiter-api) (#916)
hoangnam2261 Jul 30, 2019
ccb257d
fixed bug #883 (#885)
ranjeet-floyd Aug 4, 2019
61ef59d
fix code example containing syntax error (#890)
makaravind Aug 11, 2019
085e47b
Update SonarCloud badge
iluwatar Aug 21, 2019
11c0550
Create .sonarcloud.properties
iluwatar Aug 21, 2019
7f6067f
Added priority queue design pattern (#888)
ranjeet-floyd Aug 31, 2019
318f811
Bytecode pattern #553 (#896)
pzawitowski Sep 3, 2019
35dc25d
MInor bug fix Issue #895 -> Code comment change (https://github.com/i…
saksham93 Sep 7, 2019
c653edf
fix must override a superclass method (#919)
anancds Sep 7, 2019
8c865e6
clean code (#910)
ibrahimAlii Sep 7, 2019
f141033
Fix issue #761: ThreadSafeDoubleCheckLocking.java: Instantiating by R…
Azureyjt Sep 7, 2019
88fae07
Fix broken links #915 (#921)
snehalatapandit Sep 7, 2019
9bf7a05
Java Design Patterns v1.21.0
iluwatar Sep 8, 2019
b874adc
Set version for next development iteration
iluwatar Sep 8, 2019
019abc9
Add license headers
iluwatar Sep 10, 2019
5f39f7f
Updating README.md file to update doc as suggested in issue#925 (#926)
hbothra15 Sep 20, 2019
6b297b7
Data Locality pattern #559 (#889)
ranjeet-floyd Sep 30, 2019
06fa92a
Removing the dead link to resove automagic issue as mentioned in issu…
hbothra15 Sep 30, 2019
3d62e02
fixed bug #929: close async service before the main thread finishes (…
npczwh Sep 30, 2019
b03e0b8
Fix for BallThreadTest#testResume (#935)
anirudh708 Oct 1, 2019
823c58b
added new information (#937)
dignat Oct 2, 2019
05d0f0b
#834 Fix dependency management issue for POM files (#940)
perwramdemark Oct 3, 2019
218ba44
Upgrade of maven plugins (#951)
perwramdemark Oct 5, 2019
364c43a
Get rid of build warnings WARNING about problems found when building …
perwramdemark Oct 5, 2019
933de30
Add JXR plugin to get rid of WARNING Unable to locate Source XRef to …
perwramdemark Oct 5, 2019
60171e3
Fix for Issue #549 : Update Exception Handling Code in Aggregator Mic…
jarpit96 Oct 6, 2019
94ca254
Fix for issue #954 : Add external Dependencies to run with Java11 (#957)
jarpit96 Oct 6, 2019
2b1c09a
Fix link in Acyclic Visitor
iluwatar Oct 7, 2019
f5455f9
update buggy dependencies (#968)
Scuilion Oct 7, 2019
84c4b03
Fix: Github reports security vulnerabilities #933 (#960)
gaurav9822 Oct 8, 2019
f903d7e
#496 Pipeline pattern (#967)
jjjimenez100 Oct 8, 2019
41b8d80
Close #969 (#972)
erikgajdos1997 Oct 8, 2019
90ea450
Leader Election Pattern (#923)
Azureyjt Oct 8, 2019
795b6be
Configure Travis to build on JDK8 and JDK11
iluwatar Oct 11, 2019
71f26c3
Fix Travis xvfb
iluwatar Oct 11, 2019
e36bbbb
Maven profiles to support jdk 11 builds. #948 (#975)
lbroman Oct 11, 2019
6faec99
Bump java language to 11 (#980)
lbroman Oct 12, 2019
fcc1c0a
[mvn] - Remove maven-pmd-plugin from the project (#977) (#979)
Shumyk Oct 12, 2019
9ebbc42
Update license headers
iluwatar Oct 12, 2019
72b1746
#996 Fix SonarCloud analysis failure (#997)
iluwatar Oct 13, 2019
cfdfedb
#970 single logging framework should be enforced (#982)
jjjimenez100 Oct 13, 2019
47d92bb
#996 set sonar host url
iluwatar Oct 14, 2019
088bb76
#996 disable sonar analysis for pull requests (#999)
iluwatar Oct 14, 2019
7e698a9
Fix for issue #413: Circuit Breaker Pattern (#986)
PalAditya Oct 14, 2019
e6c71b6
988: Replaced all of the Apache HttpClients with Java's java.net.http…
oconnelc Oct 15, 2019
dd5997b
993: Fixed the pipeines project layout so that it will load in Eclips…
oconnelc Oct 15, 2019
c438ec0
Intermittent test failure in Spatial Partition pattern #1001 (#1006)
afflato Oct 15, 2019
27c131c
#1001 fix intermittent test failure (#1008)
Smirne Oct 15, 2019
a5646b6
#554: Subclass Sandbox pattern (#998)
Azureyjt Oct 16, 2019
880b234
Fixes #1007 by updating JUnit to 5.5.2 (#1015)
kaiwinter Oct 17, 2019
c308ca0
1011: Fixed all of the SonarCloud blocking errors (#1017)
oconnelc Oct 18, 2019
2982db4
Update README.md
iluwatar Oct 18, 2019
a204383
init repo for role object
Oct 19, 2019
c365610
add to init
Oct 19, 2019
0c60a95
Switched to embedded Google checkstyle rules (#1018)
kaiwinter Oct 19, 2019
8a48447
Remove obsolete file
iluwatar Oct 19, 2019
7c5d5f6
1010: Fixed all of the blocking and critical Sonarcloud errors (#1020)
oconnelc Oct 19, 2019
f09a7eb
add to init
Oct 19, 2019
f671f03
Update FAQ metadata
iluwatar Oct 19, 2019
82f9a6c
1010: Fixed the two remaining SonarCloud errors (#1023)
oconnelc Oct 20, 2019
2217fbc
Issue#550: double buffer pattern (#1024)
Azureyjt Oct 20, 2019
f00ebe1
#984 local variable inference changes (#1025)
Anurag870 Oct 20, 2019
20b4195
add first impl
Oct 20, 2019
5fc03ee
improve grammar of README (#945)
jonlaokan Oct 20, 2019
c81c3ff
Use local variable type inference (#995)
zbeach Oct 21, 2019
4904d7e
#1021: Fix checkstyle warnings by changing the license header templat…
vanogrid Oct 22, 2019
acaa6cd
local variable type inference changes (#1028)
gvsharma Oct 23, 2019
630532c
add pattern
Oct 24, 2019
9403d53
add license
Oct 24, 2019
1b6cecd
Update keywords
iluwatar Oct 24, 2019
1cb1bdc
https://github.com/iluwatar/java-design-patterns/issues/1009 - remove…
akrystian Oct 25, 2019
6aeafcf
https://github.com/iluwatar/java-design-patterns/issues/1016 - decrea…
akrystian Oct 26, 2019
70ddeaa
Create FUNDING.yml
iluwatar Oct 26, 2019
f7a53f2
service-layer local type inference changes (#1034)
gvsharma Oct 26, 2019
58d8fa1
local variable type inference changes (#1035)
gvsharma Oct 26, 2019
0b8d78e
local variable type inference changes (#1036)
gvsharma Oct 26, 2019
12f13a6
local variable infere changes (#1038)
gvsharma Oct 26, 2019
349d8ed
local variable type inference changes (#1039)
gvsharma Oct 26, 2019
af8c5ed
local variable type inference changes (#1040)
gvsharma Oct 26, 2019
03e1e92
local variable type inference changes (#1041)
gvsharma Oct 26, 2019
954e730
local variable type inference changes (#1043)
gvsharma Oct 26, 2019
c7fee7b
local variable type inference changes (#1042)
gvsharma Oct 26, 2019
fadad43
#984 for unitofwork, tolerantreader, twin (#1044)
Anurag870 Oct 26, 2019
e382794
add changes
Oct 26, 2019
d01a3a6
Update Github token
iluwatar Oct 26, 2019
5d47488
Fix error when building from a submodule directory (#1045)
vanogrid Oct 26, 2019
d1767bb
The pattern Role object (#1031)
besok Oct 26, 2019
9f7e3fe
Update license headers
iluwatar Oct 26, 2019
b50189e
Fix Role Object front matter
iluwatar Oct 26, 2019
63fb8dc
Add java 11 (#1048)
leonmak Oct 27, 2019
6bb3438
Add java 11 (#1049)
leonmak Oct 27, 2019
dd971d8
Use java 11 (#1050)
leonmak Oct 28, 2019
c8a481b
Add java 11 support for #987 (o-t) (#1051)
leonmak Oct 29, 2019
a65a601
Update web site logic
iluwatar Oct 29, 2019
ccc1a63
Update script
iluwatar Oct 29, 2019
ff52848
Update script
iluwatar Oct 29, 2019
91a085d
Update script
iluwatar Oct 30, 2019
fca7e9c
https://github.com/iluwatar/java-design-patterns/issues/1021 - decrea…
akrystian Oct 30, 2019
a9dfd7e
Update license header
iluwatar Oct 30, 2019
cdb80b8
Issue 893 (#1014)
hbothra15 Oct 30, 2019
cc85c73
Move faq.md to java-design-patterns-web repository
iluwatar Oct 30, 2019
1eb1961
Remove presentations
iluwatar Oct 30, 2019
3b1a281
decrease number of checkstyle errors in singleton, strategy and visit…
leonorader Oct 31, 2019
55b0341
Fix remaining Checkstyle errors for Singleton
iluwatar Oct 31, 2019
1d4a768
Fix for Issue #549 : Add Fallbacks in Aggregator Service (#971)
jarpit96 Nov 1, 2019
a8c7771
#1021 style changes for Specification
iluwatar Nov 1, 2019
768e647
add saga init dsc
Nov 2, 2019
564cf12
add init saga dsc
Nov 2, 2019
7ac47b2
add changes to dsc
Nov 2, 2019
0b17abd
#590 Add explanation for Specification pattern
iluwatar Nov 2, 2019
c4c37d7
add
Nov 2, 2019
3a4677c
add orchestrator
Nov 2, 2019
1b32e23
add ch
Nov 3, 2019
ffeee2f
separate pkgs
Nov 3, 2019
fbcfeb0
add info
Nov 3, 2019
7dc47da
#1021 Checkstyle fixes for Composite pattern
iluwatar Nov 5, 2019
47ae477
#1021 Checkstyle changes for Factory Method
iluwatar Nov 5, 2019
8ecdee4
#1021 Checkstyle fixes for Layers
iluwatar Nov 5, 2019
50986fa
#590 arrange Layers into packages and add explanation
iluwatar Nov 5, 2019
1fa8a60
Sharding Pattern (#1056)
Azureyjt Nov 8, 2019
09b4663
add choreogr
Nov 9, 2019
8f85353
merge changes
Nov 9, 2019
74c7273
rem space
Nov 9, 2019
6d1c0b1
Resolves checkstyle errors for ambassador, async-method-invocation, b…
anuragagarwal561994 Nov 9, 2019
efc17fc
Resolves checkstyle errors for business-delegate, bytecode, caching (…
anuragagarwal561994 Nov 9, 2019
31f27a7
Resolves checkstyle errors for callback, chain, circuit-breaker (#1060)
anuragagarwal561994 Nov 9, 2019
2f49648
Resolves checkstyle errors for collection-pipeline, command, commande…
anuragagarwal561994 Nov 9, 2019
de56cbb
change according to cgeckstyle
Nov 10, 2019
4f9ee01
Resolves checkstyle errors for converter, cqrs (#1063)
anuragagarwal561994 Nov 10, 2019
dda0953
Resolves checkstyle errors for guarded-suspension, half-sync-half-asy…
anuragagarwal561994 Nov 10, 2019
7f06f3b
Resolves checkstyle errors for intercepting-filter, interpreter, iter…
anuragagarwal561994 Nov 10, 2019
eae09fc
Resolves checkstyle errors for api-gateway, lazy-loading, leader-elec…
anuragagarwal561994 Nov 10, 2019
01e489c
Resolves checkstyle errors for dao data-bus data-locality data-mapper…
anuragagarwal561994 Nov 10, 2019
f2c91eb
Resolves checkstyle errors for delegation dependency-injection dirty-…
anuragagarwal561994 Nov 10, 2019
7c888e8
Resolves checkstyle errors for eip-* (#1069)
anuragagarwal561994 Nov 10, 2019
5ae2ce6
Resolves checkstyle errors for event-* (#1070)
anuragagarwal561994 Nov 10, 2019
4dae1fa
Resolves checkstyle errors for execute-around extension-objects (#1071)
anuragagarwal561994 Nov 10, 2019
9c8ad44
Resolves checkstyle errors for patterns starting with letter r (#1072)
anuragagarwal561994 Nov 10, 2019
b92eb52
Resolves checkstyle errors for template-method thread-pool throttling…
anuragagarwal561994 Nov 10, 2019
f0f0143
Resolves checkstyle errors for trampoline twin typeobjectpattern unit…
anuragagarwal561994 Nov 10, 2019
c441831
Java 11 migration: ambassador async-method-invocation balking bridge …
anuragagarwal561994 Nov 11, 2019
329479d
#984 update Ambassador readme
iluwatar Nov 11, 2019
0272d71
#984 update Bridge readme
iluwatar Nov 11, 2019
2628cc0
#984 update Builder readme
iluwatar Nov 11, 2019
c954a43
Resolves checkstyle errors for facade factory-kit spatial-partition s…
anuragagarwal561994 Nov 11, 2019
37599eb
Resolves checkstyle errors for feature-toggle fluentinterface flux fl…
anuragagarwal561994 Nov 11, 2019
3907951
Resolves checkstyle issues for semaphore servant serverless service-l…
anuragagarwal561994 Nov 11, 2019
1e76d91
Resolves checkstyle errors for abstract-document abstract-factory acy…
anuragagarwal561994 Nov 11, 2019
6ef840f
Resolves checkstyle errors for naked-objects null-object object-mothe…
anuragagarwal561994 Nov 12, 2019
33ea733
Java 11 migration: patterns (remaining b-c) (#1081)
anuragagarwal561994 Nov 12, 2019
3c57bf7
#984 #987 update readmes
iluwatar Nov 12, 2019
f04fc3c
Java 11 migration: patterns starting with a (#1084)
anuragagarwal561994 Nov 13, 2019
160b737
Add another real world example for Builder
iluwatar Nov 13, 2019
87af122
add changes according to google style
Nov 13, 2019
50467c9
Java 11 migration: patterns (t-v) (#1085)
anuragagarwal561994 Nov 14, 2019
51b444d
Merge branch 'master' of https://github.com/besok/java-design-patterns
iluwatar Nov 14, 2019
cc571f4
Saga pattern (#1062)
besok Nov 14, 2019
df8a4e3
Adding parameterized specification (Issue#1055) (#1088)
MaVdbussche Nov 16, 2019
3ccc9ba
Game Loop Pattern (#1083)
Azureyjt Nov 16, 2019
1fdc650
Resolves checkstyle errors for remaining m (#1090)
anuragagarwal561994 Nov 16, 2019
26f4aa8
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
iluwatar Nov 16, 2019
271d7ae
Resolves checkstyle errors for remaining p (#1091)
anuragagarwal561994 Nov 16, 2019
9e58edf
Merge branch 'master' of https://github.com/iluwatar/java-design-patt…
iluwatar Nov 16, 2019
8747f1f
#1021 enforce Checkstyle rules in the build
iluwatar Nov 16, 2019
cc4b990
#590 Add explanation for Converter pattern
iluwatar Nov 16, 2019
63c707f
Add game-loop to parent pom.xml
iluwatar Nov 16, 2019
19b129c
Fix several frontmatter issues
iluwatar Nov 16, 2019
73f9b8b
Adding composite specification (Issue#1093) (#1094)
MaVdbussche Nov 17, 2019
7d84550
Java Design Patterns 1.22.0
iluwatar Nov 17, 2019
6941e65
Set version for next development iteration
iluwatar Nov 17, 2019
8037495
Add some formatting to Specification pattern readme
iluwatar Nov 17, 2019
7e4d0b4
Changes aggregation to composition (as described in issue #1095) (#1096)
dgruntz Nov 18, 2019
d4b2496
Update App.java (#1098)
dgruntz Nov 18, 2019
515b7e7
Changes the implementation of the prototype pattern (#1103)
dgruntz Nov 19, 2019
e0b728c
Package patterns into executable jars setup (#1092)
hbothra15 Nov 19, 2019
1fbe9bb
Changes the description of the template method pattern (as discussed …
dgruntz Nov 19, 2019
a9c3df7
Changes the description of the prototype pattern (#1102)
dgruntz Nov 19, 2019
05e582c
Pattern combinator (#1105)
besok Nov 26, 2019
55769e9
Update Method pattern (#1106)
Azureyjt Dec 1, 2019
0685a50
#1113 Add uml-reverse-mapper plugin
iluwatar Dec 7, 2019
b09b100
#1113 Link uml-reverse-mapper created class diagrams to readme, where…
iluwatar Dec 7, 2019
fb2c026
Java 11 migrate remaining e (#1112)
anuragagarwal561994 Dec 9, 2019
0335c61
Fix Acyclic Visitor readme layout
iluwatar Dec 13, 2019
b2b1ba9
https://github.com/iluwatar/java-design-patterns-web/issues/8 Update …
iluwatar Dec 13, 2019
5681684
https://github.com/iluwatar/java-design-patterns-web/issues/8 Fix typ…
iluwatar Dec 13, 2019
ea57934
Java 11 migrate c-d (remaining) (#1111)
anuragagarwal561994 Dec 14, 2019
7d0a5c0
Issue 989 batch-2 (#1108)
hbothra15 Dec 18, 2019
f835d3d
Java 11 migrate remaining (g,h,i) (#1116)
anuragagarwal561994 Dec 20, 2019
670c4e4
Java 11 migrate 7 remaining f (#1115)
anuragagarwal561994 Dec 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,63 +26,60 @@
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Page Object pattern wraps an UI component with an application specific API allowing you to
* manipulate the UI elements without having to dig around with the underlying UI technology used. This is
* especially useful for testing as it means your tests will be less brittle. Your tests can concentrate on
* the actual test cases where as the manipulation of the UI can be left to the internals of the page object
* itself.
* manipulate the UI elements without having to dig around with the underlying UI technology used.
* This is especially useful for testing as it means your tests will be less brittle. Your tests can
* concentrate on the actual test cases where as the manipulation of the UI can be left to the
* internals of the page object itself.
*
* <p>
* Due to this reason, it has become very popular within the test automation community.
* In particular, it is very common in that the page object is used to represent the html pages of a
* web application that is under test. This web application is referred to as AUT (Application Under Test).
* A web browser automation tool/framework like Selenium for instance, is then used to drive the automating
* of the browser navigation and user actions journeys through this web application. Your test class would
* therefore only be responsible for particular test cases and page object would be used by the test class
* for UI manipulation required for the tests.
* <p>Due to this reason, it has become very popular within the test automation community. In
* particular, it is very common in that the page object is used to represent the html pages of a
* web application that is under test. This web application is referred to as AUT (Application Under
* Test). A web browser automation tool/framework like Selenium for instance, is then used to drive
* the automating of the browser navigation and user actions journeys through this web application.
* Your test class would therefore only be responsible for particular test cases and page object
* would be used by the test class for UI manipulation required for the tests.
*
* <p>
* In this implementation rather than using Selenium, the HtmlUnit library is used as a replacement to
* represent the specific html elements and to drive the browser. The purpose of this example is just to
* provide a simple version that showcase the intentions of this pattern and how this pattern is used
* in order to understand it.
* <p>In this implementation rather than using Selenium, the HtmlUnit library is used as a
* replacement to represent the specific html elements and to drive the browser. The purpose of this
* example is just to provide a simple version that showcase the intentions of this pattern and how
* this pattern is used in order to understand it.
*/
public final class App {

private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

private App() {
}

/**
* Application entry point
*
* <p>
* The application under development is a web application. Normally you would probably have a
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves
* the frontend which comprises of a series of HTML, CSS, JS etc...
* <p>The application under development is a web application. Normally you would probably have a
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves the
* frontend which comprises of a series of HTML, CSS, JS etc...
*
* <p>
* For illustrations purposes only, a very simple static html app is used here. This main method
* just fires up this simple web app in a default browser.
* <p>For illustrations purposes only, a very simple static html app is used here. This main
* method just fires up this simple web app in a default browser.
*
* @param args arguments
*/
public static void main(String[] args) {

try {
File applicationFile = new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
File applicationFile =
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());

// should work for unix like OS (mac, unix etc...)
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(applicationFile);

} else {
// java Desktop not supported - above unlikely to work for Windows so try following instead...
// java Desktop not supported - above unlikely to work for Windows so try instead...
Runtime.getRuntime().exec("cmd.exe start " + applicationFile);
}

Expand Down
47 changes: 22 additions & 25 deletions page-object/src/main/java/com/iluwatar/pageobject/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,23 @@

/**
* Page Object pattern wraps an UI component with an application specific API allowing you to
* manipulate the UI elements without having to dig around with the underlying UI technology used. This is
* especially useful for testing as it means your tests will be less brittle. Your tests can concentrate on
* the actual test cases where as the manipulation of the UI can be left to the internals of the page object
* itself.
* manipulate the UI elements without having to dig around with the underlying UI technology used.
* This is especially useful for testing as it means your tests will be less brittle. Your tests can
* concentrate on the actual test cases where as the manipulation of the UI can be left to the
* internals of the page object itself.
*
* <p>
* Due to this reason, it has become very popular within the test automation community.
* In particular, it is very common in that the page object is used to represent the html pages of a
* web application that is under test. This web application is referred to as AUT (Application Under Test).
* A web browser automation tool/framework like Selenium for instance, is then used to drive the automating
* of the browser navigation and user actions journeys through this web application. Your test class would
* therefore only be responsible for particular test cases and page object would be used by the test class
* for UI manipulation required for the tests.
* <p>Due to this reason, it has become very popular within the test automation community. In
* particular, it is very common in that the page object is used to represent the html pages of a
* web application that is under test. This web application is referred to as AUT (Application Under
* Test). A web browser automation tool/framework like Selenium for instance, is then used to drive
* the automating of the browser navigation and user actions journeys through this web application.
* Your test class would therefore only be responsible for particular test cases and page object
* would be used by the test class for UI manipulation required for the tests.
*
* <p>
* In this implementation rather than using Selenium, the HtmlUnit library is used as a replacement to
* represent the specific html elements and to drive the browser. The purpose of this example is just to
* provide a simple version that showcase the intentions of this pattern and how this pattern is used
* in order to understand it.
* <p>In this implementation rather than using Selenium, the HtmlUnit library is used as a
* replacement to represent the specific html elements and to drive the browser. The purpose of this
* example is just to provide a simple version that showcase the intentions of this pattern and how
* this pattern is used in order to understand it.
*/
public final class App {

Expand All @@ -57,21 +55,20 @@ private App() {
/**
* Application entry point
*
* <p>
* The application under development is a web application. Normally you would probably have a
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves
* the frontend which comprises of a series of HTML, CSS, JS etc...
* <p>The application under development is a web application. Normally you would probably have a
* backend that is probably implemented in an object-oriented language (e.g. Java) that serves the
* frontend which comprises of a series of HTML, CSS, JS etc...
*
* <p>
* For illustrations purposes only, a very simple static html app is used here. This main method
* just fires up this simple web app in a default browser.
* <p>For illustrations purposes only, a very simple static html app is used here. This main
* method just fires up this simple web app in a default browser.
*
* @param args arguments
*/
public static void main(String[] args) {

try {
File applicationFile = new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());
File applicationFile =
new File(App.class.getClassLoader().getResource("sample-ui/login.html").getPath());

// should work for unix like OS (mac, unix etc...)
if (Desktop.isDesktopSupported()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
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;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -46,15 +44,15 @@ public class AlbumListPage extends Page {


/**
* Constructor
* Constructor.
*/
public AlbumListPage(WebClient webClient) {
super(webClient);
}


/**
* Navigates to the Album List Page
* Navigates to the Album List Page.
*
* @return {@link AlbumListPage}
*/
Expand All @@ -76,7 +74,7 @@ public boolean isAt() {
}

/**
* Selects an album by the given album title
* Selects an album by the given album title.
*
* @param albumTitle the title of the album to click
* @return the album page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@

package com.iluwatar.pageobject;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Page Object encapsulating the Album Page (album-page.html)
Expand All @@ -49,15 +47,15 @@ public class AlbumPage extends Page {


/**
* Constructor
* Constructor.
*/
public AlbumPage(WebClient webClient) {
super(webClient);
}


/**
* Navigates to the album page
* Navigates to the album page.
*
* @return {@link AlbumPage}
*/
Expand All @@ -81,7 +79,7 @@ public boolean isAt() {


/**
* Sets the album title input text field
* Sets the album title input text field.
*
* @param albumTitle the new album title value to set
* @return {@link AlbumPage}
Expand All @@ -94,7 +92,7 @@ public AlbumPage changeAlbumTitle(String albumTitle) {


/**
* Sets the artist input text field
* Sets the artist input text field.
*
* @param artist the new artist value to set
* @return {@link AlbumPage}
Expand All @@ -107,7 +105,7 @@ public AlbumPage changeArtist(String artist) {


/**
* Selects the select's option value based on the year value given
* Selects the select's option value based on the year value given.
*
* @param year the new year value to set
* @return {@link AlbumPage}
Expand All @@ -121,7 +119,7 @@ public AlbumPage changeAlbumYear(int year) {


/**
* Sets the album rating input text field
* Sets the album rating input text field.
*
* @param albumRating the new album rating value to set
* @return {@link AlbumPage}
Expand All @@ -133,20 +131,21 @@ public AlbumPage changeAlbumRating(String albumRating) {
}

/**
* Sets the number of songs number input field
* Sets the number of songs number input field.
*
* @param numberOfSongs the new number of songs value to be set
* @return {@link AlbumPage}
*/
public AlbumPage changeNumberOfSongs(int numberOfSongs) {
HtmlNumberInput numberOfSongsNumberField = (HtmlNumberInput) page.getElementById("numberOfSongs");
HtmlNumberInput numberOfSongsNumberField =
(HtmlNumberInput) page.getElementById("numberOfSongs");
numberOfSongsNumberField.setText(Integer.toString(numberOfSongs));
return this;
}


/**
* Cancel changes made by clicking the cancel button
* Cancel changes made by clicking the cancel button.
*
* @return {@link AlbumListPage}
*/
Expand All @@ -162,7 +161,7 @@ public AlbumListPage cancelChanges() {


/**
* Saves changes made by clicking the save button
* Saves changes made by clicking the save button.
*
* @return {@link AlbumPage}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -45,7 +44,7 @@ public class LoginPage extends Page {
private HtmlPage page;

/**
* Constructor
* Constructor.
*
* @param webClient {@link WebClient}
*/
Expand All @@ -54,7 +53,7 @@ public LoginPage(WebClient webClient) {
}

/**
* Navigates to the Login page
* Navigates to the Login page.
*
* @return {@link LoginPage}
*/
Expand All @@ -77,7 +76,7 @@ public boolean isAt() {


/**
* Enters the username into the username input text field
* Enters the username into the username input text field.
*
* @param username the username to enter
* @return {@link LoginPage}
Expand All @@ -90,23 +89,24 @@ public LoginPage enterUsername(String username) {


/**
* Enters the password into the password input password field
* Enters the password into the password input password field.
*
* @param password the password to enter
* @return {@link LoginPage}
*/
public LoginPage enterPassword(String password) {
HtmlPasswordInput passwordInputPasswordField = (HtmlPasswordInput) page.getElementById("password");
HtmlPasswordInput passwordInputPasswordField =
(HtmlPasswordInput) page.getElementById("password");
passwordInputPasswordField.setText(password);
return this;
}


/**
* Clicking on the login button to 'login'
* 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");
Expand Down
Loading