@Test(expected = IllegalStateException.class) public void testUpdateIllegal() { taskRes.updateTask(2, task1); }
@Operation(description = "Change task") @PUT @Path("{id}") public void updateTask(@PathParam("id") Integer id, Task task) { if (!task.getId().equals(id)) { throw new IllegalStateException("Id from path and content must be the same"); } taskService.addOrUpdate(task); }
TaskResource { @Operation(description = "Change task") @PUT @Path("{id}") public void updateTask(@PathParam("id") Integer id, Task task) { if (!task.getId().equals(id)) { throw new IllegalStateException("Id from path and content must be the same"); } taskService.addOrUpdate(task); } }
TaskResource { @Operation(description = "Change task") @PUT @Path("{id}") public void updateTask(@PathParam("id") Integer id, Task task) { if (!task.getId().equals(id)) { throw new IllegalStateException("Id from path and content must be the same"); } taskService.addOrUpdate(task); } TaskResource(TaskService taskService, MetricRegistry metricRegistry); }
TaskResource { @Operation(description = "Change task") @PUT @Path("{id}") public void updateTask(@PathParam("id") Integer id, Task task) { if (!task.getId().equals(id)) { throw new IllegalStateException("Id from path and content must be the same"); } taskService.addOrUpdate(task); } TaskResource(TaskService taskService, MetricRegistry metricRegistry); @Operation(summary = "Get single task by id", description = "Get single task by id") @GET @Path("{id}") Response getTask(@PathParam("id") Integer id); @Operation(description = "Add task") @POST Response addTask(Task task); @Operation(description = "Get all tasks") @GET @Produces(MediaType.APPLICATION_JSON) Collection<Task> getTasks(); @Operation(description = "Change task") @PUT @Path("{id}") void updateTask(@PathParam("id") Integer id, Task task); @Operation(description = "Delete task") @DELETE @Path("{id}") void deleteTask(@PathParam("id") Integer id); }
TaskResource { @Operation(description = "Change task") @PUT @Path("{id}") public void updateTask(@PathParam("id") Integer id, Task task) { if (!task.getId().equals(id)) { throw new IllegalStateException("Id from path and content must be the same"); } taskService.addOrUpdate(task); } TaskResource(TaskService taskService, MetricRegistry metricRegistry); @Operation(summary = "Get single task by id", description = "Get single task by id") @GET @Path("{id}") Response getTask(@PathParam("id") Integer id); @Operation(description = "Add task") @POST Response addTask(Task task); @Operation(description = "Get all tasks") @GET @Produces(MediaType.APPLICATION_JSON) Collection<Task> getTasks(); @Operation(description = "Change task") @PUT @Path("{id}") void updateTask(@PathParam("id") Integer id, Task task); @Operation(description = "Delete task") @DELETE @Path("{id}") void deleteTask(@PathParam("id") Integer id);  }