@Test @InSequence(3) public void testPut() { MultivaluedHashMap<String, String> map = new MultivaluedHashMap<>(); map.add("name", "Howard"); map.add("age", "4"); target.request().post(Entity.form(map)); Employee[] list = target.request().get(Employee[].class); assertEquals(4, list.length); assertEquals("Howard", list[3].getName()); assertEquals(4, list[3].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);  }