### Question:
DefaultDirectoryWriter implements DirectoryWriter { @Override public String toJson( @NotNull final File directory, @URL final String requestURL, final boolean includeParent ) throws Exception { final Directory dir = this.getDirectory(directory, requestURL, includeParent); return GenieObjectMapper.getMapper().writeValueAsString(dir); }  static String directoryToHTML(final String directoryName, final Directory directory); @Override String toHtml(
        @NotNull final File directory,
        @URL final String requestURL,
        final boolean includeParent
    ); @Override String toJson(
        @NotNull final File directory,
        @URL final String requestURL,
        final boolean includeParent
    );  }### Answer:
@Test void canConvertToJson() throws Exception { this.setupWithParent(); final String json = this.writer.toJson(this.directory, REQUEST_URL_WITH_PARENT, true); Assertions.assertThat(json).isNotNull(); final DefaultDirectoryWriter.Directory dir = GenieObjectMapper.getMapper().readValue(json, DefaultDirectoryWriter.Directory.class); Assertions.assertThat(dir.getParent()).isNotNull(); Assertions.assertThat(dir.getParent().getName()).isEqualTo(PARENT_NAME); Assertions.assertThat(dir.getParent().getUrl()).isEqualTo(PARENT_URL); Assertions.assertThat(dir.getParent().getSize()).isEqualTo(PARENT_SIZE); Assertions.assertThat(dir.getParent().getLastModified()).isEqualTo(PARENT_LAST_MODIFIED); Assertions.assertThat(dir.getDirectories()).isNotNull(); Assertions .assertThat(dir.getDirectories()) .containsExactlyInAnyOrder(this.directoryEntry1, this.directoryEntry2); Assertions.assertThat(dir.getFiles()).isNotNull(); Assertions .assertThat(dir.getFiles()) .containsExactlyInAnyOrder(this.fileEntry1, this.fileEntry2); }