Search in sources :

Example 1 with HTMLDocumentationTemplate

use of org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate 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 HTMLDocumentationTemplate

use of org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate in project kie-wb-common by kiegroup.

the class DMNDocumentationServiceImplTest method testGetDocumentationTemplate.

@Test
public void testGetDocumentationTemplate() {
    final HTMLDocumentationTemplate documentationTemplate = service.getDocumentationTemplate();
    final String expectedTemplate = "documentationTemplate";
    final String actualTemplate = documentationTemplate.getTemplate();
    assertEquals(expectedTemplate, actualTemplate);
}
Also used : HTMLDocumentationTemplate(org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate) Test(org.junit.Test)

Example 3 with HTMLDocumentationTemplate

use of org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate 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 4 with HTMLDocumentationTemplate

use of org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate in project kie-wb-common by kiegroup.

the class ClientBPMNDocumentationServiceTest method buildDocumentation.

@Test
public void buildDocumentation() {
    final HTMLDocumentationTemplate documentationTemplate = tested.getDocumentationTemplate();
    final BPMNDocumentation bpmnDocumentation = tested.processDocumentation(diagram);
    final DocumentationOutput documentationOutput = tested.buildDocumentation(documentationTemplate, bpmnDocumentation);
    assertEquals(RENDERED_DOC, documentationOutput.getValue());
}
Also used : DocumentationOutput(org.kie.workbench.common.stunner.core.documentation.model.DocumentationOutput) HTMLDocumentationTemplate(org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate) BPMNDocumentation(org.kie.workbench.common.stunner.bpmn.documentation.model.BPMNDocumentation) Test(org.junit.Test)

Example 5 with HTMLDocumentationTemplate

use of org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate in project kie-wb-common by kiegroup.

the class ClientBPMNDocumentationServiceTest method getDocumentationTemplate.

@Test
public void getDocumentationTemplate() {
    final HTMLDocumentationTemplate documentationTemplate = tested.getDocumentationTemplate();
    assertEquals(TEMPLATE, documentationTemplate.getTemplate());
}
Also used : HTMLDocumentationTemplate(org.kie.workbench.common.stunner.core.documentation.model.HTMLDocumentationTemplate) Test(org.junit.Test)

Aggregations

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