SubscriptionResource { @ApiOperation(notes = "Removes a Subscription", value = "deleteSubscription") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @DELETE @Path("/{subscription_id}") @Produces(MediaType.APPLICATION_JSON) public void deleteSubscription(@PathParam("subscription_id") String subscriptionId) { int count = 0; for (Pool pool : this.poolManager.getPoolsBySubscriptionId(subscriptionId)) { this.poolManager.deletePool(pool); ++count; } if (count == 0) { throw new NotFoundException( i18n.tr("A subscription with the ID \"{0}\" could not be found.", subscriptionId)); } } @Inject  SubscriptionResource(SubscriptionServiceAdapter subService,
        ConsumerCurator consumerCurator, PoolManager poolManager, I18n i18n); @ApiOperation(notes = "Retrieves a list of Subscriptions", value = "getSubscriptions") @GET @Produces(MediaType.APPLICATION_JSON) List<Subscription> getSubscriptions(); @ApiOperation(notes = "Retrieves a single Subscription", value = "getSubscription") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @GET @Path("/{subscription_id}") @Produces(MediaType.APPLICATION_JSON) Subscription getSubscription(@PathParam("subscription_id") String subscriptionId); @ApiOperation(notes = "Retrieves a Subscription Certificate As a PEM", value = "getSubCertAsPem") @DoNotUseJAXBProvider @GET @Path("{subscription_id}/cert") // cpc passes up content-type on all calls, make sure we don't 415 it @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Produces({ MediaType.TEXT_PLAIN }) String getSubCertAsPem(
        @PathParam("subscription_id") String subscriptionId); @ApiOperation(notes = "Retrieves a Subscription Certificate", value = "getSubCert") @GET @Path("{subscription_id}/cert") @Consumes({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) @Produces({ MediaType.APPLICATION_JSON}) CertificateDTO getSubCert(
        @PathParam("subscription_id") String subscriptionId); @ApiOperation(notes = "Activates a Subscription", value = "activateSubscription") @ApiResponses({ @ApiResponse(code = 400, message = ""), @ApiResponse(code = 503, message = ""), @ApiResponse(code = 202, message = "") }) @POST @Produces(MediaType.WILDCARD) @Consumes(MediaType.WILDCARD) Response activateSubscription(
        @ApiParam(required = true) @QueryParam("consumer_uuid") @Verify(Consumer.class) String consumerUuid,
        @ApiParam(required = true) @QueryParam("email") String email,
        @ApiParam(required = true) @QueryParam("email_locale") String emailLocale); @ApiOperation(notes = "Removes a Subscription", value = "deleteSubscription") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @DELETE @Path("/{subscription_id}") @Produces(MediaType.APPLICATION_JSON) void deleteSubscription(@PathParam("subscription_id") String subscriptionId);  }
@Test public void testInvalidIdOnDelete() throws Exception { CandlepinQuery<Pool> cqmock = mock(CandlepinQuery.class); when(cqmock.list()).thenReturn(Collections.<Pool>emptyList()); when(cqmock.iterator()).thenReturn(Collections.<Pool>emptyList().iterator()); when(poolManager.getPoolsBySubscriptionId(anyString())).thenReturn(cqmock); assertThrows(NotFoundException.class, () -> subResource.deleteSubscription("JarJarBinks")); }