### Question:
DMNDocumentationView extends DefaultDiagramDocumentationView { void refreshDocumentationHTML() { documentationContent.innerHTML = getDocumentationHTML(); } @Inject  DMNDocumentationView(final HTMLDivElement documentationPanel,
                                final HTMLDivElement documentationContent,
                                final HTMLButtonElement printButton,
                                final HTMLButtonElement downloadHtmlFile,
                                final PrintHelper printHelper,
                                final DMNDocumentationService documentationService,
                                final HTMLDownloadHelper downloadHelper,
                                final DMNDocumentationViewButtonsVisibilitySupplier buttonsVisibilitySupplier); @Override DocumentationView<Diagram> refresh(); @Override boolean isEnabled(); @EventHandler("print-button") void onPrintButtonClick(final ClickEvent e); @EventHandler("download-html-file") void onDownloadHtmlFile(final ClickEvent e);  }### Answer:
@Test public void testRefreshDocumentationHTMLWhenDiagramIsPresent() { final String expectedHTML = "<html />"; final DocumentationOutput output = new DocumentationOutput(expectedHTML); doReturn(Optional.of(diagram)).when(view).getDiagram(); when(documentationService.generate(diagram)).thenReturn(output); documentationContent.innerHTML = "something"; view.refreshDocumentationHTML(); final String actualHTML = documentationContent.innerHTML; assertEquals(expectedHTML, actualHTML); }
@Test public void testRefreshDocumentationHTMLWhenDiagramIsNotPresent() { final String expectedHTML = EMPTY.getValue(); doReturn(Optional.empty()).when(view).getDiagram(); documentationContent.innerHTML = "something"; view.refreshDocumentationHTML(); final String actualHTML = documentationContent.innerHTML; assertEquals(expectedHTML, actualHTML); }