@Test
  public void testNullFlatValue2Document() {

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

    assertNull("Document must be null!", doc);
  }
  @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());
  }
  @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());
  }
 @Test
 public void testNull2FlatValue() {
   DocumentData documentData = processor.toFlatValue(field, null, context);
   assertNull("DocumentData must be null!", documentData);
 }