use of org.kie.dmn.model.api.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.
the class DMNDIExtensionsRegisterTest method testBeforeMarshal.
@Test
public void testBeforeMarshal() {
final DMNModelInstrumentedBase base = mock(TDefinitions.class);
when(base.getPrefixForNamespaceURI(Mockito.<String>any())).thenReturn(Optional.empty());
register.beforeMarshal(base, qmap);
verify(qmap).registerMapping(qNameCaptor.capture(), eq(COMPONENTS_WIDTHS_EXTENSION_ALIAS));
final QName qName1 = qNameCaptor.getValue();
assertThat(qName1.getNamespaceURI()).isEqualTo(KIE.getUri());
assertThat(qName1.getLocalPart()).isEqualTo(COMPONENTS_WIDTHS_EXTENSION_ALIAS);
assertThat(qName1.getPrefix()).isEqualTo(KIE.getPrefix());
verify(qmap).registerMapping(qNameCaptor.capture(), eq(COMPONENT_WIDTHS_ALIAS));
final QName qName2 = qNameCaptor.getValue();
assertThat(qName2.getNamespaceURI()).isEqualTo(KIE.getUri());
assertThat(qName2.getLocalPart()).isEqualTo(COMPONENT_WIDTHS_ALIAS);
assertThat(qName2.getPrefix()).isEqualTo(KIE.getPrefix());
verify(qmap).registerMapping(qNameCaptor.capture(), eq(COMPONENT_WIDTH_ALIAS));
final QName qName3 = qNameCaptor.getValue();
assertThat(qName3.getNamespaceURI()).isEqualTo(KIE.getUri());
assertThat(qName3.getLocalPart()).isEqualTo(COMPONENT_WIDTH_ALIAS);
assertThat(qName3.getPrefix()).isEqualTo(KIE.getPrefix());
verify(qmap).registerMapping(qNameCaptor.capture(), eq(EXTERNAL_LINK_ALIAS));
final QName qName4 = qNameCaptor.getValue();
assertThat(qName4.getNamespaceURI()).isEqualTo(KIE.getUri());
assertThat(qName4.getLocalPart()).isEqualTo(EXTERNAL_LINK_ALIAS);
assertThat(qName4.getPrefix()).isEqualTo(KIE.getPrefix());
}
use of org.kie.dmn.model.api.DMNModelInstrumentedBase in project kie-wb-common by kiegroup.
the class QNamePropertyConverterTest method testGetDefaultNamespaceFromParent.
@Test
public void testGetDefaultNamespaceFromParent() {
final String defaultNamespace = "http://www.kiegroup.org/";
final TDefinitions definition = mock(TDefinitions.class);
final DMNModelInstrumentedBase model = mock(DMNModelInstrumentedBase.class);
when(model.getParent()).thenReturn(definition);
when(definition.getNamespace()).thenReturn(defaultNamespace);
final String actual = QNamePropertyConverter.getDefaultNamespace(model);
assertEquals(defaultNamespace, actual);
}
Aggregations