Skip to content

Commit

Permalink
test: do not perform indefinite awaits in MultiTransformToUniTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jponge committed Dec 13, 2023
1 parent 90fe69a commit cdbd2eb
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
Expand All @@ -20,7 +21,7 @@ public void testTransformToUniAndConcatenate() {
.onItem()
.transformToUni(i -> Uni.createFrom().completionStage(CompletableFuture.supplyAsync(() -> i + 1)))
.concatenate()
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));

assertThat(list).containsExactly(2, 3, 4);
}
Expand Down Expand Up @@ -98,7 +99,7 @@ public void testTransformToUniAndConcatenateSingleCall() {
List<Integer> list = Multi.createFrom().range(1, 4)
.onItem()
.transformToUniAndConcatenate(i -> Uni.createFrom().completionStage(CompletableFuture.supplyAsync(() -> i + 1)))
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));

assertThat(list).containsExactly(2, 3, 4);
}
Expand All @@ -109,7 +110,7 @@ public void testTransformToUniAndMerge() {
.onItem()
.transformToUni(i -> Uni.createFrom().completionStage(CompletableFuture.supplyAsync(() -> i + 1)))
.merge()
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));

assertThat(list).containsExactlyInAnyOrder(2, 3, 4);
}
Expand Down Expand Up @@ -178,7 +179,7 @@ public void testTransformToUniAndMergeSingleCall() {
List<Integer> list = Multi.createFrom().range(1, 4)
.onItem()
.transformToUniAndMerge(i -> Uni.createFrom().completionStage(CompletableFuture.supplyAsync(() -> i + 1)))
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));
assertThat(list).containsExactlyInAnyOrder(2, 3, 4);
}

Expand All @@ -192,7 +193,7 @@ public void testTransformToUniAndMergeWithUniOfVoid() {
return i;
}
})))
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));

assertThat(list).containsExactlyInAnyOrder(1, 3, 5);
}
Expand All @@ -208,7 +209,7 @@ public void testTransformToUniAndConcatenateWithUniOfVoid() {
return i;
}
})))
.collect().asList().await().indefinitely();
.collect().asList().await().atMost(Duration.ofSeconds(5));

assertThat(list).containsExactly(1, 3, 5);
}
Expand Down

0 comments on commit cdbd2eb

Please sign in to comment.