@Test public void testSaveEntryNotOk() { Response res = controller.save(buildEntry(null, null, null, null)); assertNotNull(res); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), res.getStatus()); verifyNoInteractions(arendeDraftService); }
@PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod public Response save(ArendeDraftEntry entry) { if (!entry.isValid()) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (arendeDraftService.saveDraft(entry.getIntygId(), entry.getQuestionId(), entry.getText(), entry.getAmne())) { return Response.ok().build(); } else { return Response.serverError().build(); } }
ArendeDraftApiController { @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod public Response save(ArendeDraftEntry entry) { if (!entry.isValid()) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (arendeDraftService.saveDraft(entry.getIntygId(), entry.getQuestionId(), entry.getText(), entry.getAmne())) { return Response.ok().build(); } else { return Response.serverError().build(); } } }
ArendeDraftApiController { @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod public Response save(ArendeDraftEntry entry) { if (!entry.isValid()) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (arendeDraftService.saveDraft(entry.getIntygId(), entry.getQuestionId(), entry.getText(), entry.getAmne())) { return Response.ok().build(); } else { return Response.serverError().build(); } }  }
ArendeDraftApiController { @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod public Response save(ArendeDraftEntry entry) { if (!entry.isValid()) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (arendeDraftService.saveDraft(entry.getIntygId(), entry.getQuestionId(), entry.getText(), entry.getAmne())) { return Response.ok().build(); } else { return Response.serverError().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 { @PUT @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod public Response save(ArendeDraftEntry entry) { if (!entry.isValid()) { return Response.status(Response.Status.BAD_REQUEST).build(); } if (arendeDraftService.saveDraft(entry.getIntygId(), entry.getQuestionId(), entry.getText(), entry.getAmne())) { return Response.ok().build(); } else { return Response.serverError().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);  }