### Question:
RawTransactionResource { @ApiOperation(value = "Store raw private transaction payload") @ApiResponses({ @ApiResponse(code = 200, response = StoreRawResponse.class, message = "Store response"), @ApiResponse(code = 400, message = "For unknown sender") }) @POST @Path(ENDPOINT_STORE_RAW) @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) public Response store( @ApiParam(name = "storeRawRequest", required = true) @NotNull @Valid final StoreRawRequest request) { PublicKey sender = request.getFrom() .filter(Objects::nonNull) .map(PublicKey::from) .orElseGet(transactionManager::defaultPublicKey); com.quorum.tessera.transaction.StoreRawRequest storeRawRequest = com.quorum.tessera.transaction.StoreRawRequest.Builder.create() .withSender(sender) .withPayload(request.getPayload()) .build(); final com.quorum.tessera.transaction.StoreRawResponse response = transactionManager.store(storeRawRequest); StoreRawResponse storeRawResponse = new StoreRawResponse(); storeRawResponse.setKey(response.getHash().getHashBytes()); return Response.ok().type(APPLICATION_JSON).entity(storeRawResponse).build(); } RawTransactionResource();  RawTransactionResource(final TransactionManager transactionManager); @ApiOperation(value = "Store raw private transaction payload") @ApiResponses({ @ApiResponse(code = 200, response = StoreRawResponse.class, message = "Store response"), @ApiResponse(code = 400, message = "For unknown sender") }) @POST @Path(ENDPOINT_STORE_RAW) @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) Response store(
            @ApiParam(name = "storeRawRequest", required = true) @NotNull @Valid final StoreRawRequest request); static final String ENDPOINT_STORE_RAW; }### Answer:
@Test public void store() { com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class); MessageHash transactionHash = mock(MessageHash.class); when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes()); when(response.getHash()).thenReturn(transactionHash); when(transactionManager.store(any())).thenReturn(response); final StoreRawRequest storeRawRequest = new StoreRawRequest(); storeRawRequest.setPayload("PAYLOAD".getBytes()); storeRawRequest.setFrom("Sender".getBytes()); final Response result = transactionResource.store(storeRawRequest); assertThat(result.getStatus()).isEqualTo(200); verify(transactionManager).store(any()); }
@Test public void storeUsingDefaultKey() { com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class); MessageHash transactionHash = mock(MessageHash.class); when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes()); when(response.getHash()).thenReturn(transactionHash); when(transactionManager.store(any())).thenReturn(response); when(transactionManager.defaultPublicKey()).thenReturn(PublicKey.from("SENDER".getBytes())); final StoreRawRequest storeRawRequest = new StoreRawRequest(); storeRawRequest.setPayload("PAYLOAD".getBytes()); final Response result = transactionResource.store(storeRawRequest); assertThat(result.getStatus()).isEqualTo(200); verify(transactionManager).store(any()); verify(transactionManager).defaultPublicKey(); }