コード例 #1
0
  @Test
  public void testNullFlatValue2Document() {

    Document doc = processor.toRawValue(field, null, null, context);

    assertNull("Document must be null!", doc);
  }
コード例 #2
0
  @Test
  public void testDocument2FlatValue() {
    Document doc = new DocumentImpl("id", "docName", 1024, new Date());

    DocumentData documentData = processor.toFlatValue(field, doc, context);

    assertNotNull("DocumentData cannot be null!", documentData);
    assertEquals("Names are not equal", doc.getName(), documentData.getFileName());
    assertEquals("Sizes are not equal", doc.getSize(), documentData.getSize());
    assertEquals("Link must be empty", "", documentData.getLink());
  }
コード例 #3
0
  @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());
  }
コード例 #4
0
  @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());
  }
コード例 #5
0
 @Test
 public void testNull2FlatValue() {
   DocumentData documentData = processor.toFlatValue(field, null, context);
   assertNull("DocumentData must be null!", documentData);
 }