Search in sources :

Example 1 with DocumentationOutput

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());
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) HTMLDocumentationTemplate(org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate) Test(org.junit.Test)

Example 2 with DocumentationOutput

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);
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) HTMLDocumentationTemplate(org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate) Test(org.junit.Test)

Example 3 with DocumentationOutput

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);
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) Test(org.junit.Test)

Example 4 with DocumentationOutput

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);
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) Test(org.junit.Test)

Example 5 with DocumentationOutput

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());
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 DocumentationOutput (org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput)6 HTMLDocumentationTemplate (org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate)3 BPMNDocumentation (org.kie.workbench.common.stunner.bpmn.documentation.model.BPMNDocumentation)1