@Test public void delete() throws Exception { User user = service.create("todelete", "dontforget", "delete@me.com"); WebClient.create("http: user = service.find(user.getId()); assertNull(user); }
@Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) { User user = em.find(User.class, id); if (user != null) { em.remove(user); } }
UserService { @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) { User user = em.find(User.class, id); if (user != null) { em.remove(user); } } }
UserService { @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) { User user = em.find(User.class, id); if (user != null) { em.remove(user); } }  }
UserService { @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) { User user = em.find(User.class, id); if (user != null) { em.remove(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); }
UserService { @Path("/delete/{id}") @DELETE public void delete(@PathParam("id") long id) { User user = em.find(User.class, id); if (user != null) { em.remove(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);  }