### Question:
PartyInfoResource { @GET @Path("/keys") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Fetch network/peer public keys") @ApiResponses({@ApiResponse(code = 200, message = "Peer/Network public keys")}) public Response getPartyInfoKeys() { final NodeInfo current = this.discovery.getCurrent(); final JsonArrayBuilder recipientBuilder = Json.createArrayBuilder(); current.getRecipients().stream() .map( recipient -> Json.createObjectBuilder() .add("key", recipient.getKey().encodeToBase64()) .build()) .forEach(recipientBuilder::add); final String output = Json.createObjectBuilder() .add("keys", recipientBuilder.build()) .build() .toString(); return Response.status(Response.Status.OK).entity(output).build(); } PartyInfoResource(final Discovery discovery); @GET @Path("/keys") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Fetch network/peer keys") @ApiResponses({@ApiResponse(code = 200, message = "Peer/Network keys")}) Response getPartyInfoKeys();  }### Answer:
@Test public void getPartyInfoKeys() { final String partyInfoJson = "{\"keys\":[{\"key\":\"BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=\"},{\"key\":\"QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=\"}]}"; final NodeInfo nodeInfo = NodeInfo.Builder.create() .withUrl("http: .withRecipients(List.of( Recipient.of( PublicKey.from( Base64.getDecoder() .decode( "QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=")), "http: Recipient.of( PublicKey.from( Base64.getDecoder() .decode( "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=")), "http: .build(); when(discovery.getCurrent()).thenReturn(nodeInfo); final Response response = partyInfoResource.getPartyInfoKeys(); assertThat(response).isNotNull(); assertThat(response.getStatus()).isEqualTo(200); final String output = response.getEntity().toString(); final JsonReader expected = Json.createReader(new StringReader(partyInfoJson)); final JsonReader actual = Json.createReader(new StringReader(output)); JsonObject expectedJsonObject = expected.readObject(); JsonObject actualJsonObject = actual.readObject(); assertThat(actualJsonObject).containsOnlyKeys("keys"); assertThat(actualJsonObject.getJsonArray("keys")) .containsExactlyInAnyOrderElementsOf(expectedJsonObject.getJsonArray("keys")); verify(discovery).getCurrent(); }