Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 3cb841d

Browse files
committed
Added missing JavaDoc for core classes and AssertJ support module
1 parent 602c6bd commit 3cb841d

File tree

8 files changed

+256
-13
lines changed

8 files changed

+256
-13
lines changed

webtester-core/src/main/java/info/novatec/testit/webtester/internal/proxies/impls/DefaultMethodImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
@Slf4j
1111
public class DefaultMethodImpl implements Implementation {
1212

13-
// TODO nicer implementation?
1413
private static Constructor<MethodHandles.Lookup> methodHandlesConstructor;
1514
static {
1615
try {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/PageFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ default boolean isNotPresent() {
251251
* @since 2.0
252252
*/
253253
default boolean isEnabled() {
254-
// TODO: move to separate trait interface
255254
return webElement().isEnabled();
256255
}
257256

@@ -267,7 +266,6 @@ default boolean isEnabled() {
267266
* @since 2.0
268267
*/
269268
default boolean isDisabled() {
270-
// TODO: move to separate trait interface
271269
return !isEnabled();
272270
}
273271

webtester-core/src/main/java/info/novatec/testit/webtester/waiting/ConfiguredWait.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,50 @@
55
import info.novatec.testit.webtester.pagefragments.PageFragment;
66

77

8+
/**
9+
* This class is used to configure {@link Wait} operations with custom settings like the {@code timeout}.
10+
*
11+
* @see Wait
12+
* @see WaitUntil
13+
* @since 2.0
14+
*/
815
public class ConfiguredWait {
916

10-
// TODO document
11-
1217
private final long timeout;
1318
private final TimeUnit timeUnit;
1419

20+
/**
21+
* Creates a new {@link ConfiguredWait} instance with the given timeout in seconds.
22+
*
23+
* @param timeout the timeout to use
24+
* @since 2.0
25+
*/
1526
public ConfiguredWait(long timeout) {
1627
this(timeout, TimeUnit.SECONDS);
1728
}
1829

30+
/**
31+
* Creates a new {@link ConfiguredWait} instance with the given timeout in the given {@link TimeUnit}.
32+
*
33+
* @param timeout the timeout to use
34+
* @param timeUnit the unit of time to use
35+
* @since 2.0
36+
*/
1937
public ConfiguredWait(long timeout, TimeUnit timeUnit) {
2038
this.timeout = timeout;
2139
this.timeUnit = timeUnit;
2240
}
2341

42+
/**
43+
* Creates a {@link WaitUntil fluent wait until} with the timeout settings of this {@link ConfiguredWait} for the given
44+
* {@link PageFragment}.
45+
*
46+
* @param fragment the fragment for the wait until operation
47+
* @return the fluent wait instance
48+
* @see Wait
49+
* @see WaitUntil
50+
* @since 2.0
51+
*/
2452
public <T extends PageFragment> WaitUntil<T> until(T fragment) {
2553
return new WaitUntil<>(fragment, timeout, timeUnit);
2654
}

webtester-core/src/main/java/info/novatec/testit/webtester/waiting/WaitUntil.java

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,134 @@
44
import java.util.function.Predicate;
55

66
import info.novatec.testit.webtester.conditions.Conditions;
7+
import info.novatec.testit.webtester.config.Configuration;
78
import info.novatec.testit.webtester.pagefragments.PageFragment;
89

910

11+
/**
12+
* This class offers a number of methods which allow for the waiting until a specific condition is met for a {@link
13+
* PageFragment}.
14+
*
15+
* @see Wait
16+
* @since 2.0
17+
*/
1018
public class WaitUntil<T extends PageFragment> {
1119

12-
// TODO document
13-
1420
private final T fragment;
1521
private final long timeout;
1622
private final TimeUnit timeUnit;
1723

24+
/**
25+
* Creates a new {@link WaitUntil} instance for the given {@link PageFragment}.
26+
* The timeout configuration will be taken from the fragment's browser's {@link Configuration}.
27+
*
28+
* @param fragment the fragment to use
29+
* @see Wait
30+
* @since 2.0
31+
*/
1832
public WaitUntil(T fragment) {
1933
this.fragment = fragment;
2034
this.timeout = fragment.getBrowser().configuration().getWaitTimeout();
2135
this.timeUnit = TimeUnit.SECONDS;
2236
}
2337

38+
/**
39+
* Creates a new {@link WaitUntil} instance for the given {@link PageFragment} an timeout with {@link TimeUnit}.
40+
*
41+
* @param fragment the fragment to use
42+
* @param timeout the timeout to use
43+
* @param timeUnit the time unit to use
44+
* @see Wait
45+
* @since 2.0
46+
*/
2447
public WaitUntil(T fragment, long timeout, TimeUnit timeUnit) {
2548
this.fragment = fragment;
2649
this.timeout = timeout;
2750
this.timeUnit = timeUnit;
2851
}
2952

53+
/**
54+
* Waits until the given condition is met. A set of default conditions can be initialized from {@link Conditions}.
55+
*
56+
* @param condition the condition to wait for
57+
* @return the same instance for fluent API use
58+
* @throws TimeoutException in case the condition is not met within the configured timeout
59+
* @see Wait
60+
* @see Conditions
61+
* @since 2.0
62+
*/
3063
public WaitUntil<T> has(Predicate<? super T> condition) throws TimeoutException {
3164
return is(condition);
3265
}
3366

67+
/**
68+
* Waits until the given condition is met. A set of default conditions can be initialized from {@link Conditions}.
69+
*
70+
* @param condition the condition to wait for
71+
* @return the same instance for fluent API use
72+
* @throws TimeoutException in case the condition is not met within the configured timeout
73+
* @see Wait
74+
* @see Conditions
75+
* @since 2.0
76+
*/
3477
public WaitUntil<T> is(Predicate<? super T> condition) throws TimeoutException {
3578
WaitOperations.waitUntil(timeout, timeUnit, fragment, condition);
3679
return this;
3780
}
3881

82+
/**
83+
* Waits until the given condition is NOT met. A set of default conditions can be initialized from {@link Conditions}.
84+
*
85+
* @param condition the condition to wait for
86+
* @return the same instance for fluent API use
87+
* @throws TimeoutException in case the condition is not met within the configured timeout
88+
* @see Wait
89+
* @see Conditions
90+
* @since 2.0
91+
*/
3992
public WaitUntil<T> isNot(Predicate<? super T> condition) throws TimeoutException {
4093
return not(condition);
4194
}
4295

96+
/**
97+
* Waits until the given condition is NOT met. A set of default conditions can be initialized from {@link Conditions}.
98+
*
99+
* @param condition the condition to wait for
100+
* @return the same instance for fluent API use
101+
* @throws TimeoutException in case the condition is not met within the configured timeout
102+
* @see Wait
103+
* @see Conditions
104+
* @since 2.0
105+
*/
43106
public WaitUntil<T> not(Predicate<? super T> condition) throws TimeoutException {
44107
WaitOperations.waitUntil(timeout, timeUnit, fragment, Conditions.not(condition));
45108
return this;
46109
}
47110

111+
/**
112+
* This method does nothing by it's own. It is intended to be used in order to write more expressive linked wait
113+
* statements.
114+
* <p>
115+
* <b>Example:</b> {@code Wait.until(button).is(visible()).and().not(editable());}
116+
*
117+
* @return the same instance for fluent API use
118+
* @see Wait
119+
* @since 2.0
120+
*/
48121
public WaitUntil<T> and() {
49122
return this;
50123
}
51124

125+
/**
126+
* This method does nothing by it's own. It is intended to be used in order to write more expressive linked wait
127+
* statements.
128+
* <p>
129+
* <b>Example:</b> {@code Wait.until(button).is(visible()).but().not(editable());}
130+
*
131+
* @return the same instance for fluent API use
132+
* @see Wait
133+
* @since 2.0
134+
*/
52135
public WaitUntil<T> but() {
53136
return this;
54137
}

webtester-core/src/test/java/info/novatec/testit/webtester/internal/PostConstructInvokerTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
public class PostConstructInvokerTest {
2020

21-
// TODO: Usage of TestContext is not Thread safe! Alternatives?
22-
2321
@Test
2422
public void testInvocationOfPostConstructMethodsOfPageClass(){
2523

webtester-support-assertj3/src/main/java/info/novatec/testit/webtester/support/assertj/WebTesterAssertions.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,93 @@
1616
import info.novatec.testit.webtester.support.assertj.assertions.pagefragments.SingleSelectAssert;
1717

1818

19+
/**
20+
* This class contains a number of entry points for WebTester related {@link Assertions}.
21+
*
22+
* @see PageFragmentAssert
23+
* @see SelectableAssert
24+
* @see ButtonAssert
25+
* @see SingleSelectAssert
26+
* @see MultiSelectAssert
27+
* @see GenericTextFieldAssert
28+
* @since 2.0
29+
*/
1930
public final class WebTesterAssertions extends Assertions {
2031

32+
/**
33+
* Creates a new {@link PageFragmentAssert} for the given {@link PageFragment}.
34+
*
35+
* @param actual the page fragment to assert
36+
* @return the new assert instance
37+
* @see PageFragment
38+
* @see PageFragmentAssert
39+
* @since 2.0
40+
*/
2141
public static PageFragmentAssert assertThat(PageFragment actual) {
2242
return new PageFragmentAssert(actual);
2343
}
2444

45+
/**
46+
* Creates a new {@link SelectableAssert} for the given {@link Selectable}.
47+
*
48+
* @param actual the selectable to assert
49+
* @return the new assert instance
50+
* @see Selectable
51+
* @see SelectableAssert
52+
* @since 2.0
53+
*/
2554
public static SelectableAssert assertThat(Selectable actual) {
2655
return new SelectableAssert(actual);
2756
}
2857

58+
/**
59+
* Creates a new {@link ButtonAssert} for the given {@link Button}.
60+
*
61+
* @param actual the button to assert
62+
* @return the new assert instance
63+
* @see Button
64+
* @see ButtonAssert
65+
* @since 2.0
66+
*/
2967
public static ButtonAssert assertThat(Button actual) {
3068
return new ButtonAssert(actual);
3169
}
3270

71+
/**
72+
* Creates a new {@link SingleSelectAssert} for the given {@link SingleSelect}.
73+
*
74+
* @param actual the single select to assert
75+
* @return the new assert instance
76+
* @see SingleSelect
77+
* @see SingleSelectAssert
78+
* @since 2.0
79+
*/
3380
public static SingleSelectAssert assertThat(SingleSelect actual) {
3481
return new SingleSelectAssert(actual);
3582
}
3683

84+
/**
85+
* Creates a new {@link MultiSelectAssert} for the given {@link MultiSelect}.
86+
*
87+
* @param actual the multi select to assert
88+
* @return the new assert instance
89+
* @see MultiSelect
90+
* @see MultiSelectAssert
91+
* @since 2.0
92+
*/
3793
public static MultiSelectAssert assertThat(MultiSelect actual) {
3894
return new MultiSelectAssert(actual);
3995
}
4096

97+
/**
98+
* Creates a new {@link GenericTextFieldAssert} for the given {@link GenericTextField}.
99+
*
100+
* @param actual the text field to assert
101+
* @return the new assert instance
102+
* @see GenericTextField
103+
* @see GenericTextFieldAssert
104+
* @since 2.0
105+
*/
41106
public static GenericTextFieldAssert assertThat(GenericTextField actual) {
42107
return new GenericTextFieldAssert(actual);
43108
}

0 commit comments

Comments
 (0)