ContentResource { @ApiOperation(notes = "Retrieves a single Content", value = "getContent") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{content_uuid}") public ContentDTO getContent(@PathParam("content_uuid") String contentUuid) { Content content = this.contentCurator.getByUuid(contentUuid); if (content == null) { throw new NotFoundException( i18n.tr("Content with UUID \"{0}\" could not be found.", contentUuid)); } return this.modelTranslator.translate(content, ContentDTO.class); } @Inject  ContentResource(ContentCurator contentCurator, I18n i18n, UniqueIdGenerator idGenerator,
        EnvironmentContentCurator envContentCurator, PoolManager poolManager,
        ProductCurator productCurator, OwnerCurator ownerCurator, ModelTranslator modelTranslator); @ApiOperation(notes = "Retrieves list of Content", value = "list", response = ContentDTO.class, responseContainer = "list") @GET @Produces(MediaType.APPLICATION_JSON) CandlepinQuery<ContentDTO> list(); @ApiOperation(notes = "Retrieves a single Content", value = "getContent") @ApiResponses({ @ApiResponse(code = 400, message = "") }) @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{content_uuid}") ContentDTO getContent(@PathParam("content_uuid") String contentUuid); @ApiOperation(notes = "Creates a Content", value = "createContent") @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) ContentDTO createContent(ContentDTO content); @ApiOperation(notes = "Creates Contents in bulk", value = "createBatchContent") @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/batch") Iterable<ContentDTO> createBatchContent(List<ContentDTO> contents); @ApiOperation(notes = "Updates a Content", value = "updateContent") @PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/{content_uuid}") ContentDTO updateContent(@PathParam("content_uuid") String contentUuid, ContentDTO changes); @ApiOperation(notes = "Deletes a Content", value = "remove") @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{content_uuid}") void remove(@PathParam("content_uuid") String contentUuid);  }
@Test(expected = NotFoundException.class) public void getContentNull() { when(cc.get(anyLong())).thenReturn(null); cr.getContent("10"); }
@Test public void getContent() { Owner owner = mock(Owner.class); Content content = mock(Content.class); CandlepinQuery cqmock = mock(CandlepinQuery.class); ContentDTO expected = this.modelTranslator.translate(content, ContentDTO.class); when(cqmock.list()).thenReturn(Arrays.asList(owner)); when(oc.listAll()).thenReturn(cqmock); when(cc.getByUuid(eq("10"))).thenReturn(content); ContentDTO output = cr.getContent("10"); assertEquals(expected, output); }