ConsumerTypeResource { @ApiOperation(notes = "Removes a Consumer Type", value = "deleteConsumerType") @DELETE @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public void deleteConsumerType(@PathParam("id") String id) { ConsumerType type = consumerTypeCurator.get(id); if (type == null) { throw new NotFoundException(i18n.tr("Unit type with id {0} could not be found.", id)); } consumerTypeCurator.delete(type); } @Inject  ConsumerTypeResource(ConsumerTypeCurator consumerTypeCurator, I18n i18n,
        ModelTranslator translator); @ApiOperation(notes = "Retrieves a list of Consumer Types", value = "list", response = ConsumerTypeDTO.class, responseContainer = "list") @GET @Produces({ MediaType.APPLICATION_JSON }) @Wrapped(element = "consumertypes") CandlepinQuery<ConsumerTypeDTO> list(); @ApiOperation(notes = "Retrieves a single Consumer Type", value = "getConsumerType") @ApiResponses({ @ApiResponse(code = 404, message = "") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{id}") ConsumerTypeDTO getConsumerType(@PathParam("id") String id); @ApiOperation(notes = "Creates a Consumer Type", value = "create") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) ConsumerTypeDTO create(
        @ApiParam(name = "consumerType", required = true) ConsumerTypeDTO dto); @ApiOperation(notes = "Updates a Consumer Type", value = "update") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @PUT @Path("/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) ConsumerTypeDTO update(
        @ApiParam(name = "consumerType", required = true) ConsumerTypeDTO dto); @ApiOperation(notes = "Removes a Consumer Type", value = "deleteConsumerType") @DELETE @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) void deleteConsumerType(@PathParam("id") String id);  }
@Test public void testDeleteType() { String id = this.testType.getId(); assertNotNull(this.consumerTypeCurator.get(id)); this.consumerTypeResource.deleteConsumerType(id); this.consumerTypeCurator.flush(); this.consumerTypeCurator.clear(); assertNull(this.consumerTypeCurator.get(id)); }
@Test public void testDeleteTypeWithBadId() { assertThrows(NotFoundException.class, () -> this.consumerTypeResource.deleteConsumerType("some bad id") ); }
@Test public void testDeleteTypeWithNullId() { assertThrows(NotFoundException.class, () -> this.consumerTypeResource.deleteConsumerType(null) ); }