### Question:
TodoGatewayResource { @POST public Response createTodo(final String newTodo) { LOG.info("Request createTodo of todo {}", newTodo); Response response = repository.createTodo(newTodo); return Response.fromResponse(response).build(); }  @POST Response createTodo(final String newTodo); @DELETE @Path("/{id}") Response deleteTodo(@PathParam("id") final Long todoId); @GET @Path("/{id}") Response getTodo(@PathParam("id") final Long todoId); @GET @Operation(description = "Find all todos") Response getTodos(); @PUT @Path("/{id}") Response updateTodo(@PathParam("id") final Long todoId, final String modifiedTodo);  }### Answer:
@Test public void createTodo() { Mockito.when(response.getStatus()).thenReturn(Response.Status.CREATED.getStatusCode()); Mockito.when(response.getEntity()).thenReturn("{\n" + " \"id\": 1000,\n" + " \"title\": \"clean fridge\",\n" + " \"description\": \"It's a mess\",\n" + " \"dueDate\": \"2018-01-01T12:34:56Z\"\n" + " \"done\": false\n" + "}"); Mockito.when(service.createTodo(Mockito.anyString())).thenReturn(response); Response response = resource.createTodo("{\n" + " \"title\": \"clean fridge\",\n" + " \"description\": \"It's a mess\",\n" + " \"dueDate\": \"2018-01-01T12:34:56Z\"\n" + "}"); assertThat(response.getStatus()).isEqualTo(Response.Status.CREATED.getStatusCode()); assertThat(response.getEntity()).isEqualTo("{\n" + " \"id\": 1000,\n" + " \"title\": \"clean fridge\",\n" + " \"description\": \"It's a mess\",\n" + " \"dueDate\": \"2018-01-01T12:34:56Z\"\n" + " \"done\": false\n" + "}"); Mockito.verify(service).createTodo(Mockito.anyString()); Mockito.verifyNoMoreInteractions(service); }