ProjectAttachmentRepository { public void deleteAttachment(AttachmentValue attachment) { gridFsOperations.delete(new Query(Criteria.where("_id").is(attachment.getFileReference()))); }  AttachmentValue storeAttachment(AttachmentValue fileMetadata, InputStream binaryData); InputStream loadAttachment(AttachmentValue attachment); void deleteAttachment(AttachmentValue attachment);  }
@Test public void deleteAttachment_shouldRemoveByFileReference() throws Exception { AttachmentValue attachment = aPersitedAttachment(); projectAttachmentRepository.deleteAttachment(attachment); verify(gridFsOperations).delete(eq(new Query(Criteria.where("_id").is(attachment.getFileReference())))); }