BAEL-6578: removed comments
This commit is contained in:
parent
6fbb898059
commit
aa424d05cb
|
@ -14,13 +14,13 @@ public class CompletableFutureAllOffUnitTest {
|
||||||
@Test
|
@Test
|
||||||
void whenCallingJoin_thenBlocksThreadAndGetValue() {
|
void whenCallingJoin_thenBlocksThreadAndGetValue() {
|
||||||
CompletableFuture<String> future = waitAndReturn(1_000, "Harry");
|
CompletableFuture<String> future = waitAndReturn(1_000, "Harry");
|
||||||
assertEquals("Harry", future.join()); // waits one second
|
assertEquals("Harry", future.join());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void whenCallingJoin_thenBlocksThreadAndThrowException() {
|
void whenCallingJoin_thenBlocksThreadAndThrowException() {
|
||||||
CompletableFuture<String> futureError = waitAndThrow(1_000);
|
CompletableFuture<String> futureError = waitAndThrow(1_000);
|
||||||
assertThrows(RuntimeException.class, futureError::join); // waits one second
|
assertThrows(RuntimeException.class, futureError::join);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -28,8 +28,8 @@ public class CompletableFutureAllOffUnitTest {
|
||||||
CompletableFuture<String> f1 = waitAndReturn(1_000, "Harry");
|
CompletableFuture<String> f1 = waitAndReturn(1_000, "Harry");
|
||||||
CompletableFuture<String> f2 = waitAndReturn(2_000, "Ron");
|
CompletableFuture<String> f2 = waitAndReturn(2_000, "Ron");
|
||||||
|
|
||||||
assertEquals("Harry", f1.join()); // waits for one second
|
assertEquals("Harry", f1.join());
|
||||||
assertEquals("Ron", f2.join()); // waits for one more second
|
assertEquals("Ron", f2.join());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ public class CompletableFutureAllOffUnitTest {
|
||||||
CompletableFuture<String> f1 = waitAndReturn(1_000, "Harry");
|
CompletableFuture<String> f1 = waitAndReturn(1_000, "Harry");
|
||||||
CompletableFuture<String> f2 = waitAndReturn(2_000, "Ron");
|
CompletableFuture<String> f2 = waitAndReturn(2_000, "Ron");
|
||||||
|
|
||||||
CompletableFuture<Void> combinedFutures = CompletableFuture.allOf(f1, f2); // does NOT wait
|
CompletableFuture<Void> combinedFutures = CompletableFuture.allOf(f1, f2);
|
||||||
combinedFutures.join(); // waits for two seconds
|
combinedFutures.join();
|
||||||
|
|
||||||
assertEquals("Harry", f1.join()); // does NOT wait
|
assertEquals("Harry", f1.join());
|
||||||
assertEquals("Ron", f2.join()); // does NOT wait
|
assertEquals("Ron", f2.join());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue