Skip to content

Commit 35d9109

Browse files
committed
Building source and javadoc jars
1 parent eda3ce5 commit 35d9109

File tree

3 files changed

+97
-43
lines changed

3 files changed

+97
-43
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ plugins {
99
id("nebula.maven-scm") version "18.4.0"
1010
id("nebula.contacts") version "6.0.0"
1111
id("nebula.info-scm") version "11.3.3"
12+
id("nebula.source-jar") version "18.4.0"
13+
id("nebula.javadoc-jar") version "18.4.0"
1214
id("tylerthrailkill.nebula-mit-license") version "0.0.3"
1315
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
1416

src/main/java/com/webfleet/assertj/AsyncAssert.java

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,54 @@
1515
public interface AsyncAssert
1616
{
1717
/**
18-
* Awaits until all assertions are passed or timeout is exceeded.
18+
* Awaits, until all configured assertions are passed or timeout is exceeded.
19+
* <p>
1920
* Assertions are configured in lambda consumer of {@link SoftAssertions} object on each check.
2021
* The checks are executed periodically with check interval delay configured with {@link AsyncAssert#withCheckInterval} method.
2122
* After exceeding timeout {@link AssertionError} will be thrown with failures from last assertion check.
22-
*
23-
* <pre><code class='java'>
23+
* <p>
24+
* Example usage:
25+
* <pre>{@code
2426
* awaitAtMostOneSecond().untilAssertions(async -> {
2527
* async.assertThat(getValue()).isEqualTo(expected);
2628
* async.assertThat(isDone()).isTrue();
2729
* });
28-
* </code></pre>
30+
* }</pre>
2931
*
3032
* @param assertionsConfigurer lambda consumer configuring {@link SoftAssertions} object
3133
*/
3234
void untilAssertions(Consumer<SoftAssertions> assertionsConfigurer);
3335

3436
/**
35-
* Configures assertion to use give mutex object for check interval wait logic.
36-
*
37+
* Configures assertion to use given mutex object for check interval wait logic.
38+
* <p>
3739
* In multi-thread applications, the mutex object can be used to notify the other thread about state change.
3840
* For asynchronous assertion, the mutex object can be used to reduce the wait time between checks with {@link Object#notifyAll()} call.
41+
* <p>
42+
* Example usage:
43+
* <pre>{@code
44+
* // given
45+
* var condition = new AtomicBoolean();
46+
* var waitMutex = new Object();
47+
* var executor = Executors.newSingleThreadExecutor();
48+
*
49+
* // when
50+
* executor.execute(() -> {
51+
* // ... asynchronous logic
52+
* condition.set(true);
53+
* // notify after done
54+
* synchronized (waitMutex) {
55+
* waitMutex.notifyAll();
56+
* }
57+
* });
58+
*
59+
* // then
60+
* awaitAtMostOneSecond()
61+
* .usingWaitMutex(waitMutex)
62+
* .untilAssertions(async -> {
63+
* async.assertThat(condition).isTrue();
64+
* });
65+
* }</pre>
3966
*
4067
* @param waitMutex mutex object
4168
* @return new {@link AsyncAssert} using given wait mutex
@@ -45,6 +72,15 @@ public interface AsyncAssert
4572
/**
4673
* Configures the interval to be waited between assertions checks.
4774
* The interval must be greater than zero and lower than timeout.
75+
* <p>
76+
* Example usage:
77+
* <pre>{@code
78+
* awaitAtMostOneSecond()
79+
* .withCheckInterval(Duration.ofMillis(500))
80+
* .untilAssertions(async -> {
81+
* async.assertThat(condition).isTrue();
82+
* });
83+
* }</pre>
4884
*
4985
* @param checkInterval check interval
5086
* @return new {@link AsyncAssert} with set check interval
@@ -54,6 +90,15 @@ public interface AsyncAssert
5490
/**
5591
* Configures the interval to be waited between assertions checks.
5692
* The interval must be greater than zero and lower than timeout.
93+
* <p>
94+
* Example usage:
95+
* <pre>{@code
96+
* awaitAtMostOneSecond()
97+
* .withCheckInterval(500, TimeUnit.MILLISECONDS)
98+
* .untilAssertions(async -> {
99+
* async.assertThat(condition).isTrue();
100+
* });
101+
* }</pre>
57102
*
58103
* @param checkInterval check interval
59104
* @param timeUnit the time unit of the check interval

src/main/java/com/webfleet/assertj/AsyncAssertions.java

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99

1010

1111
/**
12-
* Entry point for asynchronous assertions.
12+
* Entry point for building asynchronous assertions.
1313
*/
1414
@NoArgsConstructor(access = AccessLevel.PRIVATE)
1515
public final class AsyncAssertions
1616
{
1717
/**
18-
* Returns evaluator of asynchronous assertions with given timeout.
19-
* See {@link AsyncAssert} for more details.
20-
*
21-
* <pre><code class='java'>
18+
* Builds asynchronous assertion with given timeout.
19+
* <p>
20+
* Example usage:
21+
* <pre>{@code
2222
* awaitAtMost(Duration.ofSeconds(5)).untilAssertions(async -> {
2323
* async.assertThat(getValue()).isEqualTo(expected);
2424
* });
25-
* </code></pre>
25+
* }</pre>
26+
* See {@link AsyncAssert} for more details.
2627
*
2728
* @param timeout timeout for the assertions
2829
* @return {@link AsyncAssert}
@@ -33,16 +34,17 @@ public static AsyncAssert awaitAtMost(@NonNull final Duration timeout)
3334
}
3435

3536
/**
36-
* Returns evaluator of asynchronous assertions with given timeout.
37-
* See {@link AsyncAssert} for more details.
38-
*
39-
* <pre><code class='java'>
37+
* Builds asynchronous assertion with given timeout value and time unit.
38+
* <p>
39+
* Example usage:
40+
* <pre>{@code
4041
* awaitAtMost(5, SECONDS).untilAssertions(async -> {
4142
* async.assertThat(getValue()).isEqualTo(expected);
4243
* });
43-
* </code></pre>
44+
* }</pre>
45+
* See {@link AsyncAssert} for more details.
4446
*
45-
* @param timeout timeout value for the assertions
47+
* @param timeout timeout value for the assertion
4648
* @param timeUnit timeout unit
4749
* @return {@link AsyncAssert}
4850
*/
@@ -52,14 +54,15 @@ public static AsyncAssert awaitAtMost(final long timeout, @NonNull final TimeUni
5254
}
5355

5456
/**
55-
* Returns evaluator of asynchronous assertions with 1 second timeout.
56-
* See {@link AsyncAssert} for more details.
57-
*
58-
* <pre><code class='java'>
57+
* Builds asynchronous assertion with 1 second timeout.
58+
* <p>
59+
* Example usage:
60+
* <pre>{@code
5961
* awaitAtMostOneSecond().untilAssertions(async -> {
6062
* async.assertThat(getValue()).isEqualTo(expected);
6163
* });
62-
* </code></pre>
64+
* }</pre>
65+
* See {@link AsyncAssert} for more details.
6366
*
6467
* @return {@link AsyncAssert}
6568
*/
@@ -69,14 +72,15 @@ public static AsyncAssert awaitAtMostOneSecond()
6972
}
7073

7174
/**
72-
* Returns evaluator of asynchronous assertions with 2 seconds timeout.
73-
* See {@link AsyncAssert} for more details.
74-
*
75-
* <pre><code class='java'>
75+
* Builds asynchronous assertion with 2 seconds timeout.
76+
* <p>
77+
* Example usage:
78+
* <pre>{@code
7679
* awaitAtMostTwoSeconds().untilAssertions(async -> {
7780
* async.assertThat(getValue()).isEqualTo(expected);
7881
* });
79-
* </code></pre>
82+
* }</pre>
83+
* See {@link AsyncAssert} for more details.
8084
*
8185
* @return {@link AsyncAssert}
8286
*/
@@ -86,14 +90,15 @@ public static AsyncAssert awaitAtMostTwoSeconds()
8690
}
8791

8892
/**
89-
* Returns evaluator of asynchronous assertions with 5 seconds timeout.
90-
* See {@link AsyncAssert} for more details.
91-
*
92-
* <pre><code class='java'>
93+
* Builds asynchronous assertion with 5 seconds timeout.
94+
* <p>
95+
* Example usage:
96+
* <pre>{@code
9397
* awaitAtMostFiveSeconds().untilAssertions(async -> {
9498
* async.assertThat(getValue()).isEqualTo(expected);
9599
* });
96-
* </code></pre>
100+
* }</pre>
101+
* See {@link AsyncAssert} for more details.
97102
*
98103
* @return {@link AsyncAssert}
99104
*/
@@ -103,14 +108,15 @@ public static AsyncAssert awaitAtMostFiveSeconds()
103108
}
104109

105110
/**
106-
* Returns evaluator of asynchronous assertions with 15 seconds timeout.
107-
* See {@link AsyncAssert} for more details.
108-
*
109-
* <pre><code class='java'>
111+
* Builds asynchronous assertion with 15 seconds timeout.
112+
* <p>
113+
* Example usage:
114+
* <pre>{@code
110115
* awaitAtMostFifteenSeconds().untilAssertions(async -> {
111116
* async.assertThat(getValue()).isEqualTo(expected);
112117
* });
113-
* </code></pre>
118+
* }</pre>
119+
* See {@link AsyncAssert} for more details.
114120
*
115121
* @return {@link AsyncAssert}
116122
*/
@@ -120,14 +126,15 @@ public static AsyncAssert awaitAtMostFifteenSeconds()
120126
}
121127

122128
/**
123-
* Returns evaluator of asynchronous assertions with 30 seconds timeout.
124-
* See {@link AsyncAssert} for more details.
125-
*
126-
* <pre><code class='java'>
129+
* Builds asynchronous assertion with 30 seconds timeout.
130+
* <p>
131+
* Example usage:
132+
* <pre>{@code
127133
* awaitAtMostThirtySeconds().untilAssertions(async -> {
128134
* async.assertThat(getValue()).isEqualTo(expected);
129135
* });
130-
* </code></pre>
136+
* }</pre>
137+
* See {@link AsyncAssert} for more details.
131138
*
132139
* @return {@link AsyncAssert}
133140
*/

0 commit comments

Comments
 (0)