### Question:
RestResendClient implements ResendClient { @Override public boolean makeResendRequest(final String targetUrl, final ResendRequest request) { final Entity<ResendRequest> outboundEntity = Entity.entity(request, MediaType.APPLICATION_JSON); try (Response response = client.target(targetUrl).path("/resend").request().post(outboundEntity)) { return Response.Status.OK.getStatusCode() == response.getStatus(); } } RestResendClient(final Client client); @Override boolean makeResendRequest(final String targetUrl, final ResendRequest request);  }### Answer:
@Test public void makeResendRequest() { Invocation.Builder m = restClient.getWebTarget().getMockInvocationBuilder(); List<Entity> postedEntities = new ArrayList<>(); doAnswer( (invocation) -> { postedEntities.add(invocation.getArgument(0)); return Response.ok().build(); }) .when(m) .post(any(Entity.class)); String targetUrl = "http: ResendRequest request = new ResendRequest(); boolean result = client.makeResendRequest(targetUrl, request); assertThat(postedEntities).hasSize(1); assertThat(result).isTrue(); Entity entity = postedEntities.get(0); assertThat(entity.getMediaType()).isEqualTo(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); assertThat(entity.getEntity()).isSameAs(request); }
@Test public void makeResendRequestReturns500() { Invocation.Builder m = restClient.getWebTarget().getMockInvocationBuilder(); doAnswer( (invocation) -> { return Response.serverError().build(); }) .when(m) .post(any(Entity.class)); String targetUrl = "http: ResendRequest request = new ResendRequest(); boolean result = client.makeResendRequest(targetUrl, request); assertThat(result).isFalse(); }