@Test public void testDeleteNotFound() { final String intygId = "intygId"; final String questionId = "questionId"; when(arendeDraftService.delete(intygId, questionId)).thenReturn(false); Response res = controller.delete(intygId, questionId); assertNotNull(res); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), res.getStatus()); verify(arendeDraftService).delete(intygId, questionId); verifyNoMoreInteractions(arendeDraftService); }
@DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod public Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId) { String resolvedQuestionId = StringUtils.trimToNull(questionId); if (arendeDraftService.delete(intygId, resolvedQuestionId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
ArendeDraftApiController { @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod public Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId) { String resolvedQuestionId = StringUtils.trimToNull(questionId); if (arendeDraftService.delete(intygId, resolvedQuestionId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } }
ArendeDraftApiController { @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod public Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId) { String resolvedQuestionId = StringUtils.trimToNull(questionId); if (arendeDraftService.delete(intygId, resolvedQuestionId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }  }
ArendeDraftApiController { @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod public Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId) { String resolvedQuestionId = StringUtils.trimToNull(questionId); if (arendeDraftService.delete(intygId, resolvedQuestionId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }  @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response save(ArendeDraftEntry entry); @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId); @GET @Path("/{intygId}") @Produces(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response getQuestionDraft(@PathParam("intygId") String intygId); }
ArendeDraftApiController { @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod public Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId) { String resolvedQuestionId = StringUtils.trimToNull(questionId); if (arendeDraftService.delete(intygId, resolvedQuestionId)) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }  @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response save(ArendeDraftEntry entry); @DELETE @Path("/{intygId}{questionId:(/[^/]+?)?}") @PrometheusTimeMethod Response delete(@PathParam("intygId") String intygId, @PathParam("questionId") String questionId); @GET @Path("/{intygId}") @Produces(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response getQuestionDraft(@PathParam("intygId") String intygId);  }