UserService { @Path("/create") @PUT public User create(@QueryParam("name") String name, @QueryParam("pwd") String pwd, @QueryParam("mail") String mail) { User user = new User(); user.setFullname(name); user.setPassword(pwd); user.setEmail(mail); em.persist(user); return user; }  @Path("/create") @PUT User create(@QueryParam("name") String name,
                       @QueryParam("pwd") String pwd,
                       @QueryParam("mail") String mail); @Path("/list") @GET List<User> list(@QueryParam("first") @DefaultValue("0") int first,
                           @QueryParam("max") @DefaultValue("20") int max); @Path("/show/{id}") @GET User find(@PathParam("id") long id); @Path("/delete/{id}") @DELETE void delete(@PathParam("id") long id); @Path("/update/{id}") @POST Response update(@PathParam("id") long id,
                           @QueryParam("name") String name,
                           @QueryParam("pwd") String pwd,
                           @QueryParam("mail") String mail);  }
@Test public void create() { int expected = service.list(0, 100).size() + 1; Response response = WebClient.create("http: .path("/user/create") .query("name", "dummy") .query("pwd", "unbreakable") .query("mail", "foo@bar.fr") .put(null); List<User> list = service.list(0, 100); for (User u : list) { if (!users.contains(u)) { service.delete(u.getId()); return; } } fail("user was not added"); }
@Test public void show() { User user = WebClient.create("http: .path("/user/show/" + users.iterator().next().getId()) .get(User.class); assertEquals("foo", user.getFullname()); assertEquals("foopwd", user.getPassword()); assertEquals("foo@foo.com", user.getEmail()); }