AssetServiceLayer { public Attachment retrieveAttachmentMetadata(String assetId, String attachmentId, UriInfo uriInfo) throws NonExistentArtefactException { Attachment attachment = persistenceBean.retrieveAttachmentMetadata(attachmentId); if (!Objects.equals(attachment.getAssetId(), assetId)) { throw new NonExistentArtefactException("Asset " + assetId + " has no associated attachment with id " + attachmentId); } computeAttachmentURL(attachment, uriInfo); return attachment; }  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 testRetrieveNonExistentAttachment() throws NonExistentArtefactException, InvalidIdException { service.retrieveAttachmentMetadata("01234", "67864", dummyUriInfo); }