use of org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput in project kie-wb-common by kiegroup.
the class DMNDocumentationServiceImplTest method testBuildDocumentation.
@Test
public void testBuildDocumentation() {
final HTMLDocumentationTemplate template = mock(HTMLDocumentationTemplate.class);
final DMNDocumentation documentation = mock(DMNDocumentation.class);
final String documentationTemplate = "documentationTemplate";
final String rendered = "<template rendered='true' />";
final DocumentationOutput expectedOutput = new DocumentationOutput(rendered);
when(template.getTemplate()).thenReturn(documentationTemplate);
when(mustacheTemplateRenderer.render(documentationTemplate, documentation)).thenReturn(rendered);
final DocumentationOutput actualOutput = service.buildDocumentation(template, documentation);
assertEquals(expectedOutput.getValue(), actualOutput.getValue());
}
use of org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput in project kie-wb-common by kiegroup.
the class DMNDocumentationServiceImplTest method testGenerateWhenDiagramIsPresent.
@Test
public void testGenerateWhenDiagramIsPresent() {
final HTMLDocumentationTemplate template = mock(HTMLDocumentationTemplate.class);
final DMNDocumentation documentation = mock(DMNDocumentation.class);
final DocumentationOutput expectedOutput = mock(DocumentationOutput.class);
doReturn(template).when(service).getDocumentationTemplate();
doReturn(documentation).when(service).processDocumentation(diagram);
doReturn(expectedOutput).when(service).buildDocumentation(template, documentation);
final DocumentationOutput actualOutput = service.generate(diagram);
assertEquals(expectedOutput, actualOutput);
}
use of org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput in project kie-wb-common by kiegroup.
the class DMNDocumentationServiceImplTest method testGenerateWhenDiagramIsNotPresent.
@Test
public void testGenerateWhenDiagramIsNotPresent() {
final DocumentationOutput expectedOutput = DocumentationOutput.EMPTY;
final DocumentationOutput actualOutput = service.generate(null);
assertEquals(expectedOutput, actualOutput);
}
use of org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput in project kie-wb-common by kiegroup.
the class DMNDocumentationViewTest method testRefreshDocumentationHTMLWhenDiagramIsPresent.
@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);
}
use of org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput in project kie-wb-common by kiegroup.
the class ClientBPMNDocumentationServiceTest method generate.
@Test
public void generate() {
final DocumentationOutput documentationOutput = tested.generate(diagram);
assertEquals(RENDERED_DOC, documentationOutput.getValue());
}
Aggregations