use of com.quorum.tessera.p2p.recovery.ResendBatchRequest in project tessera by ConsenSys.
the class TransactionResourceTest method resendBatch.
@Test
public void resendBatch() {
ResendBatchRequest incoming = new ResendBatchRequest();
incoming.setPublicKey("someKey");
incoming.setBatchSize(1);
ResendBatchResponse resendResponse = ResendBatchResponse.from(1);
when(batchResendManager.resendBatch(any())).thenReturn(resendResponse);
Response result = transactionResource.resendBatch(incoming);
assertThat(result.getStatus()).isEqualTo(200);
com.quorum.tessera.p2p.recovery.ResendBatchResponse convertedResponse = (com.quorum.tessera.p2p.recovery.ResendBatchResponse) result.getEntity();
assertThat(convertedResponse.getTotal()).isEqualTo(1);
ArgumentCaptor<com.quorum.tessera.recovery.resend.ResendBatchRequest> captor = ArgumentCaptor.forClass(com.quorum.tessera.recovery.resend.ResendBatchRequest.class);
verify(batchResendManager).resendBatch(captor.capture());
com.quorum.tessera.recovery.resend.ResendBatchRequest convertedRequest = captor.getValue();
assertThat(convertedRequest.getPublicKey()).isEqualTo("someKey");
assertThat(convertedRequest.getBatchSize()).isEqualTo(1);
}
Aggregations