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));
}
Aggregations