Skip to content

Commit

Permalink
Replace Collectors#toList with Stream#toList (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
pivovarit authored Oct 9, 2023
1 parent d4d235f commit 15126c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/test/java/com/pivovarit/collectors/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private static <R extends Collection<Integer>> DynamicTest shouldMaintainOrder(C

private static <R extends Collection<Integer>> DynamicTest shouldShortCircuitOnException(CollectorSupplier<Function<Integer, Integer>, Executor, Integer, Collector<Integer, ?, CompletableFuture<R>>> collector, String name) {
return dynamicTest(format("%s: should short circuit on exception", name), () -> {
List<Integer> elements = IntStream.range(0, 100).boxed().collect(toList());
List<Integer> elements = IntStream.range(0, 100).boxed().toList();
int size = 4;

runWithExecutor(e -> {
Expand All @@ -340,7 +340,7 @@ private static <R extends Collection<Integer>> DynamicTest shouldShortCircuitOnE

private static <R extends Collection<Integer>> DynamicTest shouldHandleThrowable(CollectorSupplier<Function<Integer, Integer>, Executor, Integer, Collector<Integer, ?, CompletableFuture<R>>> collector, String name) {
return dynamicTest(format("%s: should not swallow exception", name), () -> {
List<Integer> elements = IntStream.range(0, 10).boxed().collect(toList());
List<Integer> elements = IntStream.range(0, 10).boxed().toList();

runWithExecutor(e -> {
assertThatThrownBy(elements.stream()
Expand All @@ -360,7 +360,7 @@ private static <R extends Collection<Integer>> DynamicTest shouldHandleThrowable
private static <R extends Collection<Integer>> DynamicTest shouldHandleRejectedExecutionException(CollectorSupplier<Function<Integer, Integer>, Executor, Integer, Collector<Integer, ?, CompletableFuture<R>>> collector, String name) {
return dynamicTest(format("%s: should propagate rejected execution exception", name), () -> {
Executor executor = command -> { throw new RejectedExecutionException(); };
List<Integer> elements = IntStream.range(0, 1000).boxed().collect(toList());
List<Integer> elements = IntStream.range(0, 1000).boxed().toList();

assertThatThrownBy(() -> elements.stream()
.collect(collector.apply(i -> returnWithDelay(i, ofMillis(10000)), executor, PARALLELISM))
Expand Down

0 comments on commit 15126c4

Please sign in to comment.