@Test public void testRemove() throws Exception { final Response response = resources.client().target("/v1/notifications/test").request().delete(); verify(store).removeAll("test"); assertThat(response.getStatus()).isEqualTo(204); }
@DELETE @Timed @Path("/{username}") public Response delete( @PathParam("username") final String username, @QueryParam("ids") final StringSetParam idsParam) { try { if (idsParam != null) { store.remove(username, idsParam.get()); } else { store.removeAll(username); } } catch (NotificationStoreException e) { throw new NotificationException( Response.Status.INTERNAL_SERVER_ERROR, "Unable to delete notifications", e); } return Response.noContent().build(); }
NotificationResource { @DELETE @Timed @Path("/{username}") public Response delete( @PathParam("username") final String username, @QueryParam("ids") final StringSetParam idsParam) { try { if (idsParam != null) { store.remove(username, idsParam.get()); } else { store.removeAll(username); } } catch (NotificationStoreException e) { throw new NotificationException( Response.Status.INTERNAL_SERVER_ERROR, "Unable to delete notifications", e); } return Response.noContent().build(); } }
NotificationResource { @DELETE @Timed @Path("/{username}") public Response delete( @PathParam("username") final String username, @QueryParam("ids") final StringSetParam idsParam) { try { if (idsParam != null) { store.remove(username, idsParam.get()); } else { store.removeAll(username); } } catch (NotificationStoreException e) { throw new NotificationException( Response.Status.INTERNAL_SERVER_ERROR, "Unable to delete notifications", e); } return Response.noContent().build(); } NotificationResource(final NotificationStore store); }
NotificationResource { @DELETE @Timed @Path("/{username}") public Response delete( @PathParam("username") final String username, @QueryParam("ids") final StringSetParam idsParam) { try { if (idsParam != null) { store.remove(username, idsParam.get()); } else { store.removeAll(username); } } catch (NotificationStoreException e) { throw new NotificationException( Response.Status.INTERNAL_SERVER_ERROR, "Unable to delete notifications", e); } return Response.noContent().build(); } NotificationResource(final NotificationStore store); @GET @JSONP @Timed @Path("/{username}") @Produces({MediaType.APPLICATION_JSON, "application/javascript"}) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) Response fetch(
      @HeaderParam("Range") final String rangeHeader,
      @PathParam("username") final String username); @POST @Timed @Path("/{username}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response add(
      @PathParam("username") final String username,
      @NotNull @Valid final Notification notification); @DELETE @Timed @Path("/{username}") Response delete(
      @PathParam("username") final String username,
      @QueryParam("ids") final StringSetParam idsParam); }
NotificationResource { @DELETE @Timed @Path("/{username}") public Response delete( @PathParam("username") final String username, @QueryParam("ids") final StringSetParam idsParam) { try { if (idsParam != null) { store.remove(username, idsParam.get()); } else { store.removeAll(username); } } catch (NotificationStoreException e) { throw new NotificationException( Response.Status.INTERNAL_SERVER_ERROR, "Unable to delete notifications", e); } return Response.noContent().build(); } NotificationResource(final NotificationStore store); @GET @JSONP @Timed @Path("/{username}") @Produces({MediaType.APPLICATION_JSON, "application/javascript"}) @CacheControl(mustRevalidate = true, noCache = true, noStore = true) Response fetch(
      @HeaderParam("Range") final String rangeHeader,
      @PathParam("username") final String username); @POST @Timed @Path("/{username}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response add(
      @PathParam("username") final String username,
      @NotNull @Valid final Notification notification); @DELETE @Timed @Path("/{username}") Response delete(
      @PathParam("username") final String username,
      @QueryParam("ids") final StringSetParam idsParam);  }