AssetServiceLayer { public AttachmentContentResponse retrieveAttachmentContent(String assetId, String attachmentId, String name, UriInfo uriInfo) throws NonExistentArtefactException { Attachment attachmentMetadata = retrieveAttachmentMetadata(assetId, attachmentId, uriInfo); if (!Objects.equals(name, attachmentMetadata.getName())) { throw new NonExistentArtefactException("Attachment with id " + attachmentId + " and name " + name + " does not exist in the repository."); } String gridFSId = attachmentMetadata.getGridFSId(); return persistenceBean.retrieveAttachmentContent(gridFSId); }  AssetCursor retrieveAllAssets(); AssetCursor retrieveAllAssets(Collection<AssetFilter> filters, String searchTerm, PaginationOptions pagination, SortOptions sortOptions); int countAllAssets(Collection<AssetFilter> filters, String searchTerm); List<Map<String, Object>> summarizeAssets(List<String> fields, Collection<AssetFilter> filters, String searchTerm); Asset createAsset(Asset asset, String creatorName); Asset retrieveAsset(String assetId, UriInfo uriInfo); Asset updateAsset(String assetId, Asset asset); void updateAssetState(Asset.StateAction action, String id); void deleteAsset(String assetId); Attachment createAttachmentWithContent(String assetId, String name, Attachment attachmentMetadata, String contentType,
                                                  InputStream attachmentContentStream, UriInfo uriInfo); Attachment createAttachmentNoContent(String assetId, String name, Attachment attachmentMetadata, UriInfo uriInfo); void deleteAttachment(String attachmentId); Attachment retrieveAttachmentMetadata(String assetId, String attachmentId, UriInfo uriInfo); AttachmentContentResponse retrieveAttachmentContent(String assetId, String attachmentId, String name, UriInfo uriInfo);  }
@Test(expected = NonExistentArtefactException.class) public void testRetrieveNonExistentAttachmentContent() throws NonExistentArtefactException, InvalidIdException { service.retrieveAttachmentContent("01234", "67864", "a name that does not exist.", dummyUriInfo); }