Fix suggestions

This commit is contained in:
Lucian Snare 2024-02-08 23:23:51 -05:00
parent 9ca5b38ad2
commit cd1c8de735
1 changed files with 1 additions and 5 deletions

View File

@ -51,7 +51,7 @@ public class CombiningCompletableFuturesUnitTest {
// When all CompletableFutures are completed (exceptionally or otherwise)... // When all CompletableFutures are completed (exceptionally or otherwise)...
Map<Boolean, List<Long>> resultsByValidity = clientCalls.stream() Map<Boolean, List<Long>> resultsByValidity = clientCalls.stream()
.map(this::handleFuture) .map(this::handleFuture)
.collect(Collectors.partitioningBy(this::isValidResponse)); .collect(Collectors.partitioningBy(resourceId -> resourceId != -1L));
// Then the returned resource identifiers should match what is expected... // Then the returned resource identifiers should match what is expected...
List<Long> validResults = resultsByValidity.getOrDefault(true, List.of()); List<Long> validResults = resultsByValidity.getOrDefault(true, List.of());
@ -64,10 +64,6 @@ public class CombiningCompletableFuturesUnitTest {
.error(eq("Encountered error: java.lang.IllegalArgumentException: Bad Resource")); .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. * Completes the given CompletableFuture, handling any exceptions that are thrown.
* @param future the CompletableFuture to complete. * @param future the CompletableFuture to complete.