use of org.camunda.bpm.model.xml.impl.util.ModelTypeException in project camunda-xml-model by camunda.
the class AbstractModelElementInstanceTest method testType.
@Test
public void testType() {
assertThatType().isPartOfModel(model);
TypeAssumption assumption = getTypeAssumption();
assertThatType().hasTypeNamespace(assumption.namespaceUri);
if (assumption.isAbstract) {
assertThatType().isAbstract();
} else {
assertThatType().isNotAbstract();
}
if (assumption.extendsType == null) {
assertThatType().extendsNoType();
} else {
assertThatType().extendsType(assumption.extendsType);
}
if (assumption.isAbstract) {
try {
modelInstance.newInstance(modelElementType);
fail("Element type " + modelElementType.getTypeName() + " is abstract.");
} catch (DOMException e) {
// expected exception
} catch (ModelTypeException e) {
// expected exception
} catch (Exception e) {
fail("Unexpected exception " + e.getMessage());
}
} else {
ModelElementInstance modelElementInstance = modelInstance.newInstance(modelElementType);
assertThat(modelElementInstance).isNotNull();
}
}
Aggregations