Search in sources :

Example 1 with ResendBatchRequest

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);
}
Also used : Response(jakarta.ws.rs.core.Response) ResendBatchResponse(com.quorum.tessera.recovery.resend.ResendBatchResponse) ResendBatchResponse(com.quorum.tessera.recovery.resend.ResendBatchResponse) ResendBatchRequest(com.quorum.tessera.p2p.recovery.ResendBatchRequest) Test(org.junit.Test)

Aggregations

ResendBatchRequest (com.quorum.tessera.p2p.recovery.ResendBatchRequest)1 ResendBatchResponse (com.quorum.tessera.recovery.resend.ResendBatchResponse)1 Response (jakarta.ws.rs.core.Response)1 Test (org.junit.Test)1