From cd1c8de7355afbcca23f22adf90d344cc96a586e Mon Sep 17 00:00:00 2001 From: Lucian Snare Date: Thu, 8 Feb 2024 23:23:51 -0500 Subject: [PATCH] Fix suggestions --- .../CombiningCompletableFuturesUnitTest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core-java-modules/core-java-concurrency-2/src/test/java/com/baeldung/concurrent/completablefuture/CombiningCompletableFuturesUnitTest.java b/core-java-modules/core-java-concurrency-2/src/test/java/com/baeldung/concurrent/completablefuture/CombiningCompletableFuturesUnitTest.java index dbf8b98092..2c157b3ab2 100644 --- a/core-java-modules/core-java-concurrency-2/src/test/java/com/baeldung/concurrent/completablefuture/CombiningCompletableFuturesUnitTest.java +++ b/core-java-modules/core-java-concurrency-2/src/test/java/com/baeldung/concurrent/completablefuture/CombiningCompletableFuturesUnitTest.java @@ -51,7 +51,7 @@ public class CombiningCompletableFuturesUnitTest { // When all CompletableFutures are completed (exceptionally or otherwise)... Map> resultsByValidity = clientCalls.stream() .map(this::handleFuture) - .collect(Collectors.partitioningBy(this::isValidResponse)); + .collect(Collectors.partitioningBy(resourceId -> resourceId != -1L)); // Then the returned resource identifiers should match what is expected... List validResults = resultsByValidity.getOrDefault(true, List.of()); @@ -64,10 +64,6 @@ public class CombiningCompletableFuturesUnitTest { .error(eq("Encountered error: java.lang.IllegalArgumentException: Bad Resource")); } - private boolean isValidResponse(long resourceId) { - return resourceId != -1L; - } - /** * Completes the given CompletableFuture, handling any exceptions that are thrown. * @param future the CompletableFuture to complete.