@Test public void testDrgElementWithNamespace() { final DRGElement drgElement = mock(DRGElement.class, withSettings().extraInterfaces(HasVariable.class)); final IncludedModel includedModel = mock(IncludedModel.class); final DMNIncludedNodeFactory factory = mock(DMNIncludedNodeFactory.class); final Id elementId = mock(Id.class); final String theId = "theId"; final String theName = "theName"; final String tType = "tType"; final String namespaceUri = "namespaceUri"; final String prefix = "prefix"; final String modelName = "Model Name"; final Name elementName = mock(Name.class); final IsInformationItem informationItem = mock(IsInformationItem.class); final QName qName = mock(QName.class); final Name createdName = mock(Name.class); final QName typeRef = mock(QName.class); when(includedModel.getModelName()).thenReturn(modelName); when(elementId.getValue()).thenReturn(theId); when(elementName.getValue()).thenReturn(theName); when(drgElement.getName()).thenReturn(elementName); when(drgElement.getId()).thenReturn(elementId); when(((HasVariable) drgElement).getVariable()).thenReturn(informationItem); when(qName.getLocalPart()).thenReturn(tType); when(informationItem.getTypeRef()).thenReturn(qName); when(qName.getPrefix()).thenReturn(prefix); when(qName.getNamespaceURI()).thenReturn(namespaceUri); when(factory.createName(drgElement, modelName)).thenReturn(createdName); when(factory.createTypeRef(modelName, qName)).thenReturn(typeRef); doCallRealMethod().when(factory).drgElementWithNamespace(drgElement, includedModel); factory.drgElementWithNamespace(drgElement, includedModel); verify(drgElement).setName(createdName); verify(drgElement).setAllowOnlyVisualChange(true); verify(factory).setVariable((HasVariable) drgElement, informationItem, typeRef); }
DRGElement drgElementWithNamespace(final DRGElement drgElement, final IncludedModel includeModel) { final String modelName = includeModel.getModelName(); drgElement.setName(createName(drgElement, modelName)); drgElement.setAllowOnlyVisualChange(true); if (drgElement instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) drgElement; final IsInformationItem variable = hasVariable.getVariable(); final QName qName = variable.getTypeRef(); if (qName != null && !isBuiltInType(qName.getLocalPart())) { final QName typeRef = createTypeRef(modelName, qName); setVariable(hasVariable, variable, typeRef); } } return drgElement; }
DMNIncludedNodeFactory { DRGElement drgElementWithNamespace(final DRGElement drgElement, final IncludedModel includeModel) { final String modelName = includeModel.getModelName(); drgElement.setName(createName(drgElement, modelName)); drgElement.setAllowOnlyVisualChange(true); if (drgElement instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) drgElement; final IsInformationItem variable = hasVariable.getVariable(); final QName qName = variable.getTypeRef(); if (qName != null && !isBuiltInType(qName.getLocalPart())) { final QName typeRef = createTypeRef(modelName, qName); setVariable(hasVariable, variable, typeRef); } } return drgElement; } }
DMNIncludedNodeFactory { DRGElement drgElementWithNamespace(final DRGElement drgElement, final IncludedModel includeModel) { final String modelName = includeModel.getModelName(); drgElement.setName(createName(drgElement, modelName)); drgElement.setAllowOnlyVisualChange(true); if (drgElement instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) drgElement; final IsInformationItem variable = hasVariable.getVariable(); final QName qName = variable.getTypeRef(); if (qName != null && !isBuiltInType(qName.getLocalPart())) { final QName typeRef = createTypeRef(modelName, qName); setVariable(hasVariable, variable, typeRef); } } return drgElement; }  }
DMNIncludedNodeFactory { DRGElement drgElementWithNamespace(final DRGElement drgElement, final IncludedModel includeModel) { final String modelName = includeModel.getModelName(); drgElement.setName(createName(drgElement, modelName)); drgElement.setAllowOnlyVisualChange(true); if (drgElement instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) drgElement; final IsInformationItem variable = hasVariable.getVariable(); final QName qName = variable.getTypeRef(); if (qName != null && !isBuiltInType(qName.getLocalPart())) { final QName typeRef = createTypeRef(modelName, qName); setVariable(hasVariable, variable, typeRef); } } return drgElement; }  DMNIncludedNode makeDMNIncludeNode(final String path,
                                              final IncludedModel includeModel,
                                              final DRGElement drgElement); }
DMNIncludedNodeFactory { DRGElement drgElementWithNamespace(final DRGElement drgElement, final IncludedModel includeModel) { final String modelName = includeModel.getModelName(); drgElement.setName(createName(drgElement, modelName)); drgElement.setAllowOnlyVisualChange(true); if (drgElement instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) drgElement; final IsInformationItem variable = hasVariable.getVariable(); final QName qName = variable.getTypeRef(); if (qName != null && !isBuiltInType(qName.getLocalPart())) { final QName typeRef = createTypeRef(modelName, qName); setVariable(hasVariable, variable, typeRef); } } return drgElement; }  DMNIncludedNode makeDMNIncludeNode(final String path,
                                              final IncludedModel includeModel,
                                              final DRGElement drgElement);  }