coverage for uncallable functions
@@ -78,7 +78,6 @@ public class TransactionResourceTest {
}
- @Ignore
@Test
public void receive() {
String key = Base64.getEncoder().encodeToString("KEY".getBytes());
@@ -97,14 +96,13 @@ public class TransactionResourceTest {
when(transactionManager.receive(any(com.quorum.tessera.transaction.ReceiveRequest.class))).thenReturn(receiveResponse);
- final Response result = jersey
- .target("receive")
- .request()
- .post(Entity.entity(receiveRequest, MediaType.APPLICATION_JSON));
+ TransactionResource resource = new TransactionResource(transactionManager);
+
+ final Response result = resource.receive(receiveRequest);
assertThat(result.getStatus()).isEqualTo(200);
- com.quorum.tessera.api.ReceiveResponse resultResponse = result.readEntity(com.quorum.tessera.api.ReceiveResponse.class);
+ com.quorum.tessera.api.ReceiveResponse resultResponse = (com.quorum.tessera.api.ReceiveResponse) result.getEntity();
assertThat(resultResponse.getExecHash()).isNull();
assertThat(resultResponse.getPrivacyFlag()).isEqualTo(PrivacyMode.STANDARD_PRIVATE.getPrivacyFlag());
@@ -113,7 +111,7 @@ public class TransactionResourceTest {
}
- @Ignore
+
@Test
public void receiveWithRecipient() {
String key = Base64.getEncoder().encodeToString("KEY".getBytes());
@@ -126,15 +124,13 @@ public class TransactionResourceTest {
when(transactionManager.receive(any())).thenReturn(receiveResponse);
when(receiveResponse.getUnencryptedTransactionData()).thenReturn("Result".getBytes());
- Response result = jersey
- .target("receive")
- .request()
- .post(Entity.entity(receiveRequest, MediaType.APPLICATION_JSON));
-
+ TransactionResource resource = new TransactionResource(transactionManager);
+ final Response result = resource.receive(receiveRequest);
assertThat(result.getStatus()).isEqualTo(200);
- com.quorum.tessera.api.ReceiveResponse resultResponse = result.readEntity(com.quorum.tessera.api.ReceiveResponse.class);
+ com.quorum.tessera.api.ReceiveResponse resultResponse = (com.quorum.tessera.api.ReceiveResponse) result.getEntity();
+
assertThat(resultResponse.getPrivacyFlag()).isEqualTo(PrivacyMode.STANDARD_PRIVATE.getPrivacyFlag());
assertThat(resultResponse.getExecHash()).isNull();
