### Question:
TodoBackend { @DELETE public Response delete() { posts.clear(); return Response.ok().build(); }  @GET Collection<Post> read(); @POST @Consumes(APPLICATION_JSON) Response create(@Context final UriInfo uriInfo, final Post post); @DELETE Response delete(); @GET @Path("/{id}") Post read(@PathParam("id") final int id); @PATCH @Path("/{id}") @Consumes(APPLICATION_JSON) Post update(@PathParam("id") final int id, final Post updated); @DELETE @Path("/{id}") Response delete(@PathParam("id") final int id); static void main(final String[] args);  }### Answer:
@Test public void testDeletePost() { final Response r1 = target("/").request().post(Entity.entity("{\"title\":\"blah\"}", APPLICATION_JSON)); final Post post = (Post) r1.getEntity(); target(post.url).request().delete(); final Response r3 = target(post.url).request().get(); assertEquals(404, r3.getStatus()); }
@Test @SuppressWarnings("rawtypes") public void testDeleteAll() { final Response r1 = target("/").request().delete(); assertNotNull(r1); final Response r2 = target("/").request().get(); assertNotNull(r2); assertTrue(((Collection) r2.getEntity()).isEmpty()); }