use of org.summerb.microservices.articles.api.dto.Attachment in project summerb by skarpushin.
the class AttachmentServiceImplTest method testAttachment_expectCreatedAndRetrieved.
@Test
public void testAttachment_expectCreatedAndRetrieved() throws Exception {
Attachment a = new Attachment();
a.setArticleId(createTestArticle());
a.setName("test attachment");
a.setSize(123);
a.setContents(createValidContentsReader());
Attachment result = attachmentService.create(a);
assertNotNull(result);
assertNotNull(result.getId());
assertTrue(result.getId() > 0);
Attachment b = attachmentService.findById(result.getId());
assertNotNull(b);
// NOTE: By default we don't want to open stream
assertNull(b.getContents());
}
Aggregations