@Test @InSequence(2) public void testGetSingle() { Employee p = target .path("{id}") .resolveTemplate("id", "1") .request(MediaType.APPLICATION_XML) .get(Employee.class); assertEquals("Leonard", p.getName()); assertEquals(2, p.getAge()); }
@GET @Produces({ "application/json", "application/xml" }) @Path("{id}") public Employee get(@PathParam("id") int id) { if (id < bean.getEmployees().size()) return bean.getEmployees().get(id); else return null; }
EmployeeResource { @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") public Employee get(@PathParam("id") int id) { if (id < bean.getEmployees().size()) return bean.getEmployees().get(id); else return null; } }
EmployeeResource { @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") public Employee get(@PathParam("id") int id) { if (id < bean.getEmployees().size()) return bean.getEmployees().get(id); else return null; }  }
EmployeeResource { @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") public Employee get(@PathParam("id") int id) { if (id < bean.getEmployees().size()) return bean.getEmployees().get(id); else return null; }  @GET @Produces({ "application/xml", "application/json" }) Employee[] getList(); @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") Employee get(@PathParam("id") int id); @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) void addToList(@FormParam("name") String name,
         @FormParam("age") int age); @PUT void putToList(@FormParam("name") String name,
         @FormParam("age") int age); @DELETE @Path("{name}") void deleteFromList(@PathParam("name") String name); }
EmployeeResource { @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") public Employee get(@PathParam("id") int id) { if (id < bean.getEmployees().size()) return bean.getEmployees().get(id); else return null; }  @GET @Produces({ "application/xml", "application/json" }) Employee[] getList(); @GET @Produces({ "application/json", "application/xml" }) @Path("{id}") Employee get(@PathParam("id") int id); @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) void addToList(@FormParam("name") String name,
         @FormParam("age") int age); @PUT void putToList(@FormParam("name") String name,
         @FormParam("age") int age); @DELETE @Path("{name}") void deleteFromList(@PathParam("name") String name);  }