@Test @Order(3) public void testFindByIdNotFound() { given() .pathParam("id", 99L) .when().get("/{id}") .then() .statusCode(404); }
@GET @Path("{id}") @Produces("application/json") public CompletionStage<Response> get(@PathParam("id") long id) { return employee.get(id) .thenApply(employee -> employee != null ? Response.ok(employee) : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public CompletionStage<Response> get(@PathParam("id") long id) { return employee.get(id) .thenApply(employee -> employee != null ? Response.ok(employee) : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); } }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public CompletionStage<Response> get(@PathParam("id") long id) { return employee.get(id) .thenApply(employee -> employee != null ? Response.ok(employee) : Response.status(Response.Status.NOT_FOUND)) .thenApply(Response.ResponseBuilder::build); }  }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public CompletionStage<Response> get(@PathParam("id") long id) { return employee.get(id) .thenApply(employee -> employee != null ? Response.ok(employee) : 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 { @GET @Path("{id}") @Produces("application/json") public CompletionStage<Response> get(@PathParam("id") long id) { return employee.get(id) .thenApply(employee -> employee != null ? Response.ok(employee) : 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);  }