### Question:
FluentDriverHtmlDumper { public void takeHtmlDump(String fileName, Supplier<String> htmlSupplier) { File destFile = null; try { destFile = getDestinationFile(fileName); FileUtils.write(destFile, htmlSupplier.get(), "UTF-8"); LOGGER.info("Created HTML dump at: " + destFile.getAbsolutePath()); } catch (IOException e) { try (PrintWriter printWriter = new PrintWriter(destFile, "UTF-8")) { printWriter.write("Can't dump HTML"); printWriter.println(); e.printStackTrace(printWriter); } catch (IOException ioe) { throw new RuntimeException("Error when dumping HTML", e); } } } FluentDriverHtmlDumper(Configuration configuration); void takeHtmlDump(String fileName, Supplier<String> htmlSupplier);  }### Answer:
@Test public void shouldTakeHtmlDumpWithNoConfiguration() throws IOException { initializeDestinationFile(); htmlDumper.takeHtmlDump(destinationFile.getAbsolutePath(), () -> HTML_DUMP_CONTENT); assertThat(destinationFile).exists().hasContent(HTML_DUMP_CONTENT); }
@Test public void shouldTakeHtmlDumpWithConfiguration() throws IOException { initializeDestinationFile(); when(configuration.getHtmlDumpPath()).thenReturn(destinationFile.getParent()); htmlDumper.takeHtmlDump(destinationFile.getName(), () -> HTML_DUMP_CONTENT); assertThat(destinationFile).exists().hasContent(HTML_DUMP_CONTENT); }