@Test @Order(1) public void testAll() { List<Employee> employees = given() .contentType(ContentType.JSON) .when().get("/all").as(new TypeRef<List<Employee>>() {}); assertThat(employees, hasSize(5)); assertThat(employees.get(0).id, equalTo(1L)); assertThat(employees.get(0).name, equalTo("Penny")); assertThat(employees.get(1).id, equalTo(2L)); assertThat(employees.get(1).name, equalTo("Sheldon")); assertThat(employees.get(2).id, equalTo(3L)); assertThat(employees.get(2).name, equalTo("Amy")); assertThat(employees.get(3).id, equalTo(4L)); assertThat(employees.get(3).name, equalTo("Leonard")); assertThat(employees.get(4).id, equalTo(5L)); assertThat(employees.get(4).name, equalTo("Bernadette")); }
@GET @Path("{id}") @Produces("application/json") public Employee get(@PathParam("id") long id) { return service.get(id) .orElseThrow(() -> new WebApplicationException(404)); }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public Employee get(@PathParam("id") long id) { return service.get(id) .orElseThrow(() -> new WebApplicationException(404)); } }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public Employee get(@PathParam("id") long id) { return service.get(id) .orElseThrow(() -> new WebApplicationException(404)); }  }
EmployeeResource { @GET @Path("{id}") @Produces("application/json") public Employee get(@PathParam("id") long id) { return service.get(id) .orElseThrow(() -> new WebApplicationException(404)); }  @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 { @GET @Path("{id}") @Produces("application/json") public Employee get(@PathParam("id") long id) { return service.get(id) .orElseThrow(() -> new WebApplicationException(404)); }  @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);  }