@Test
public void testToFile() throws Exception {

    Document document = new DocumentImpl(ID,
                                         NAME,
                                         SIZE,
                                         LAST_MODIFIED,
                                         LINK);
    document.setContent(CONTENT.getBytes());
    File file = document.toFile();
    Assert.assertNotNull(file);
    Assert.assertNotNull(file.getName());
    Assert.assertTrue(file.getName().contains(FILENAME));
    Assert.assertTrue(file.getName().contains(EXTENSION));
    String fileContent = new String(Files.readAllBytes(file.toPath()));
    Assert.assertNotNull(fileContent);
    Assert.assertEquals(fileContent, CONTENT);
}