@Test public void testNullFlatValue2Document() { Document doc = processor.toRawValue(field, null, null, context); assertNull("Document must be null!", doc); }
@Test public void testNewFlatValue2Document() { DocumentData data = new DocumentData("test", 1024, null); data.setContentId("content"); Document doc = processor.toRawValue(field, data, null, context); verify(uploadedDocumentManager).getFile(anyString()); verify(uploadedDocumentManager).removeFile(anyString()); assertNotNull("Document cannot be null!", doc); assertEquals("Names are not equal", data.getFileName(), doc.getName()); assertEquals("Sizes are not equal", data.getSize(), doc.getSize()); }
@Test public void testExistingFlatValue2Document() { Document doc = new DocumentImpl("id", "docName", 1024, new Date(), "aLink"); DocumentData data = new DocumentData(doc.getName(), doc.getSize(), doc.getLink()); data.setStatus(DocumentStatus.STORED); Document rawDoc = processor.toRawValue(field, data, doc, context); assertEquals("Documents must be equal!", doc, rawDoc); verify(uploadedDocumentManager, never()).getFile(anyString()); verify(uploadedDocumentManager, never()).removeFile(anyString()); }