diff --git a/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java b/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java index c04d69bbed20e..cf5f24d2a6e18 100644 --- a/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java +++ b/core/src/test/java/org/elasticsearch/indices/recovery/RecoverySourceHandlerTests.java @@ -211,8 +211,10 @@ public Translog.Operation next() throws IOException { assertThat(result.totalOperations, equalTo(expectedOps)); final ArgumentCaptor shippedOpsCaptor = ArgumentCaptor.forClass(List.class); verify(recoveryTarget).indexTranslogOperations(shippedOpsCaptor.capture(), ArgumentCaptor.forClass(Integer.class).capture()); - List shippedOps = shippedOpsCaptor.getAllValues().stream() - .flatMap(List::stream).map(o -> (Translog.Operation) o).collect(Collectors.toList()); + List shippedOps = new ArrayList<>(); + for (List list: shippedOpsCaptor.getAllValues()) { + shippedOps.addAll(list); + } shippedOps.sort(Comparator.comparing(Translog.Operation::seqNo)); assertThat(shippedOps.size(), equalTo(expectedOps)); for (int i = 0; i < shippedOps.size(); i++) {