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.