Skip to content

Commit e9c801a

Browse files
committed
Bad test design
1 parent d862eeb commit e9c801a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/test/java/org/dataloader/DataLoaderTest.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -831,19 +831,25 @@ public void should_Batch_loads_occurring_within_futures() {
831831

832832
Supplier<Object> nullValue = () -> null;
833833

834+
AtomicBoolean v4Called = new AtomicBoolean();
835+
834836
CompletableFuture.supplyAsync(nullValue).thenAccept(v1 -> {
835837
identityLoader.load("a");
836838
CompletableFuture.supplyAsync(nullValue).thenAccept(v2 -> {
837839
identityLoader.load("b");
838840
CompletableFuture.supplyAsync(nullValue).thenAccept(v3 -> {
839841
identityLoader.load("c");
840842
CompletableFuture.supplyAsync(nullValue).thenAccept(
841-
v4 ->
842-
identityLoader.load("d"));
843+
v4 -> {
844+
identityLoader.load("d");
845+
v4Called.set(true);
846+
});
843847
});
844848
});
845849
});
846850

851+
await().untilTrue(v4Called);
852+
847853
identityLoader.dispatchAndJoin();
848854

849855
assertThat(loadCalls, equalTo(

0 commit comments

Comments
 (0)