@Test @Order(4) public void testRegister() { int maxId = given() .contentType(ContentType.JSON) .when().get("/all").as(new TypeRef<List<Employee>>() {}).size(); int createdId = maxId + 1; given() .queryParam("name", "test-user") .when().post("/") .then() .statusCode(201); testFindById(createdId, "test-user"); }
@POST public CompletionStage<Response> register(@QueryParam("name") String name) { return employee.register(name) .thenApply(id -> URI.create("/" + id)) .thenApply(uri -> Response.created(uri).build()); }
EmployeeResource { @POST public CompletionStage<Response> register(@QueryParam("name") String name) { return employee.register(name) .thenApply(id -> URI.create("/" + id)) .thenApply(uri -> Response.created(uri).build()); } }
EmployeeResource { @POST public CompletionStage<Response> register(@QueryParam("name") String name) { return employee.register(name) .thenApply(id -> URI.create("/" + id)) .thenApply(uri -> Response.created(uri).build()); }  }
EmployeeResource { @POST public CompletionStage<Response> register(@QueryParam("name") String name) { return employee.register(name) .thenApply(id -> URI.create("/" + id)) .thenApply(uri -> Response.created(uri).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 { @POST public CompletionStage<Response> register(@QueryParam("name") String name) { return employee.register(name) .thenApply(id -> URI.create("/" + id)) .thenApply(uri -> Response.created(uri).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);  }