Search in sources :

Example 11 with DiagramElement

use of org.kie.dmn.model.api.dmndi.DiagramElement in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method testGetUniqueDMNShapes.

@Test
public void testGetUniqueDMNShapes() {
    final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller());
    final org.kie.dmn.model.api.dmndi.DMNDiagram diagram = mock(org.kie.dmn.model.api.dmndi.DMNDiagram.class);
    final List<DiagramElement> elements = new ArrayList<>();
    final DMNShape unique1 = mock(DMNShape.class);
    when(unique1.getId()).thenReturn("unique1");
    final DMNShape unique2 = mock(DMNShape.class);
    when(unique2.getId()).thenReturn("unique2");
    final DMNShape duplicate1 = mock(DMNShape.class);
    when(duplicate1.getId()).thenReturn("duplicate");
    final DMNShape duplicate2 = mock(DMNShape.class);
    when(duplicate2.getId()).thenReturn("duplicate");
    elements.add(unique1);
    elements.add(unique2);
    elements.add(duplicate1);
    elements.add(duplicate2);
    when(diagram.getDMNDiagramElement()).thenReturn(elements);
    final List<DMNShape> actual = marshaller.getUniqueDMNShapes(diagram);
    assertEquals(3, actual.size());
    assertTrue(actual.contains(unique1));
    assertTrue(actual.contains(unique2));
    assertTrue(actual.contains(duplicate1) || actual.contains(duplicate2));
}
Also used : DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) DMNShape(org.kie.dmn.model.api.dmndi.DMNShape) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

DiagramElement (org.kie.dmn.model.api.dmndi.DiagramElement)11 DMNDiagram (org.kie.dmn.model.api.dmndi.DMNDiagram)4 DMNStyle (org.kie.dmn.model.api.dmndi.DMNStyle)2 Style (org.kie.dmn.model.api.dmndi.Style)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 DMNShape (org.kie.dmn.model.api.dmndi.DMNShape)1