@Test @Order(5) public void testResign() { given() .pathParam("id", 1) .when().delete("/{id}") .then() .statusCode(204); given() .pathParam("id", 1) .when().get("/{id}") .then() .statusCode(404); }
@DELETE @Path("{id}") public CompletionStage<Response> resign(@PathParam("id") long id) { return employee.resign(id) .thenApply(deleted -> deleted ? Response.noContent() : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }
EmployeeResource { @DELETE @Path("{id}") public CompletionStage<Response> resign(@PathParam("id") long id) { return employee.resign(id) .thenApply(deleted -> deleted ? Response.noContent() : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); } }
EmployeeResource { @DELETE @Path("{id}") public CompletionStage<Response> resign(@PathParam("id") long id) { return employee.resign(id) .thenApply(deleted -> deleted ? Response.noContent() : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }  }
EmployeeResource { @DELETE @Path("{id}") public CompletionStage<Response> resign(@PathParam("id") long id) { return employee.resign(id) .thenApply(deleted -> deleted ? Response.noContent() : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }  @GET @Path("all") @Produces("application/json") CompletionStage<List<Employee>> getAll(); @GET @Path("{id}") @Produces("application/json") CompletionStage<Response> get(@PathParam("id") long id); @POST CompletionStage<Response> register(@QueryParam("name") String name); @DELETE @Path("{id}") CompletionStage<Response> resign(@PathParam("id") long id); }
EmployeeResource { @DELETE @Path("{id}") public CompletionStage<Response> resign(@PathParam("id") long id) { return employee.resign(id) .thenApply(deleted -> deleted ? Response.noContent() : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }  @GET @Path("all") @Produces("application/json") CompletionStage<List<Employee>> getAll(); @GET @Path("{id}") @Produces("application/json") CompletionStage<Response> get(@PathParam("id") long id); @POST CompletionStage<Response> register(@QueryParam("name") String name); @DELETE @Path("{id}") CompletionStage<Response> resign(@PathParam("id") long id);  }