use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testIsImportedDRGElementWithDmnDRGElement.
@Test
public void testIsImportedDRGElementWithDmnDRGElement() {
final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller());
final List<org.kie.dmn.model.api.DRGElement> importedDrgElements = new ArrayList<>();
final org.kie.dmn.model.api.DRGElement imported = mock(org.kie.dmn.model.api.DRGElement.class);
when(imported.getId()).thenReturn("id");
importedDrgElements.add(imported);
final org.kie.dmn.model.api.DRGElement drgElement = mock(org.kie.dmn.model.api.DRGElement.class);
when(drgElement.getId()).thenReturn("id");
final boolean actual = marshaller.isImportedDRGElement(importedDrgElements, drgElement);
assertTrue(actual);
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method createDRGElementWithNamespaceAndId.
private org.kie.dmn.model.api.DRGElement createDRGElementWithNamespaceAndId(final String namespace, final String id) {
final org.kie.dmn.model.api.DRGElement drgElement = mock(DRGElement.class);
final Map<QName, String> additionalAttributes = new HashMap<>();
additionalAttributes.put(new QName("Namespace"), namespace);
when(drgElement.getAdditionalAttributes()).thenReturn(additionalAttributes);
when(drgElement.getId()).thenReturn(id);
return drgElement;
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testRemoveDrgElementsWithoutShapeFromDMN11.
@Test
public void testRemoveDrgElementsWithoutShapeFromDMN11() {
final String id1 = "id1";
final String id2 = "id2";
final String id3 = "id3";
final DRGElement e1 = createDRGElement(id1);
final DRGElement e2 = createDRGElement(id2);
final DRGElement e3 = createDRGElement(id3);
final List<org.kie.dmn.model.api.DRGElement> drgElements = new ArrayList<>(Arrays.asList(e1, e2, e3));
final List<DMNShape> dmnShapes = new ArrayList<>();
getDMNMarshaller().removeDrgElementsWithoutShape(drgElements, dmnShapes);
assertEquals(3, drgElements.size());
assertEquals(e1, drgElements.get(0));
assertEquals(e2, drgElements.get(1));
assertEquals(e3, drgElements.get(2));
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method createDRGElement.
private DRGElement createDRGElement(final String id) {
final DRGElement element = mock(DRGElement.class);
when(element.getId()).thenReturn(id);
return element;
}
use of org.kie.dmn.model.api.DRGElement in project kie-wb-common by kiegroup.
the class DMNExternalLinksToExtensionElementsTest method testGetOrCreateExtensionElements.
@Test
public void testGetOrCreateExtensionElements() {
final DRGElement element = mock(DRGElement.class);
final DMNElement.ExtensionElements result = getOrCreateExtensionElements(element);
assertNotNull(result);
final DMNElement.ExtensionElements existingElements = mock(DMNElement.ExtensionElements.class);
when(element.getExtensionElements()).thenReturn(existingElements);
final DMNElement.ExtensionElements actual = getOrCreateExtensionElements(element);
assertEquals(actual, existingElements);
}
Aggregations