@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 Response register(@QueryParam("name") String name, @Context UriInfo uriInfo) { long createdId = service.register(name); return Response.created( uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdId)).build()) .build(); }
EmployeeResource { @POST public Response register(@QueryParam("name") String name, @Context UriInfo uriInfo) { long createdId = service.register(name); return Response.created( uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdId)).build()) .build(); } }
EmployeeResource { @POST public Response register(@QueryParam("name") String name, @Context UriInfo uriInfo) { long createdId = service.register(name); return Response.created( uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdId)).build()) .build(); }  }
EmployeeResource { @POST public Response register(@QueryParam("name") String name, @Context UriInfo uriInfo) { long createdId = service.register(name); return Response.created( uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdId)).build()) .build(); }  @GET @Path("all") @Produces("application/json") List<Employee> getAll(); @GET @Path("{id}") @Produces("application/json") Employee get(@PathParam("id") long id); @POST Response register(@QueryParam("name") String name, @Context UriInfo uriInfo); @DELETE @Path("{id}") Response resign(@PathParam("id") long id); }
EmployeeResource { @POST public Response register(@QueryParam("name") String name, @Context UriInfo uriInfo) { long createdId = service.register(name); return Response.created( uriInfo.getAbsolutePathBuilder().path(String.valueOf(createdId)).build()) .build(); }  @GET @Path("all") @Produces("application/json") List<Employee> getAll(); @GET @Path("{id}") @Produces("application/json") Employee get(@PathParam("id") long id); @POST Response register(@QueryParam("name") String name, @Context UriInfo uriInfo); @DELETE @Path("{id}") Response resign(@PathParam("id") long id);  }