Use capture and clear convenience method

This commit is contained in:
Jason Tedor 2016-01-14 16:51:36 -05:00
parent 8f67dcc348
commit 7f78d52c72
2 changed files with 3 additions and 6 deletions

View File

@ -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];
}

View File

@ -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<Exception> 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