diff --git a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java index fc0a2719300..b6b752a6ae9 100644 --- a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java @@ -566,8 +566,7 @@ public class TransportReplicationActionTests extends ESTestCase { // force a new cluster state to simulate a new master having been elected clusterService.setState(ClusterState.builder(clusterService.state())); transport.handleResponse(currentRequest.requestId, new NotMasterException("shard-failed-test")); - CapturingTransport.CapturedRequest[] retryRequests = transport.capturedRequests(); - transport.clear(); + CapturingTransport.CapturedRequest[] retryRequests = transport.getCapturedRequestsAndClear(); assertEquals(1, retryRequests.length); currentRequest = retryRequests[0]; } diff --git a/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java b/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java index db2e67eb304..e9db5e404c7 100644 --- a/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java @@ -182,8 +182,7 @@ public class ShardStateActionTests extends ESTestCase { } }); - final CapturingTransport.CapturedRequest[] capturedRequests = transport.capturedRequests(); - transport.clear(); + final CapturingTransport.CapturedRequest[] capturedRequests = transport.getCapturedRequestsAndClear(); assertThat(capturedRequests.length, equalTo(1)); assertFalse(success.get()); List possibleExceptions = new ArrayList<>(); @@ -243,8 +242,7 @@ public class ShardStateActionTests extends ESTestCase { invoked.set(true); // assert a retry request was sent - final CapturingTransport.CapturedRequest[] capturedRequests = transport.capturedRequests(); - transport.clear(); + final CapturingTransport.CapturedRequest[] capturedRequests = transport.getCapturedRequestsAndClear(); retried.set(capturedRequests.length == 1); if (retried.get()) { // finish the request