use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelElementTypeAssert method isNotExtendedBy.
public ModelElementTypeAssert isNotExtendedBy(ModelElementType... types) {
isNotNull();
List<ModelElementType> notExtendingTypes = Arrays.asList(types);
Collection<ModelElementType> actualExtendingTypes = actual.getExtendingTypes();
List<ModelElementType> errorTypes = new ArrayList<ModelElementType>();
for (ModelElementType notExtendingType : notExtendingTypes) {
if (actualExtendingTypes.contains(notExtendingType)) {
errorTypes.add(notExtendingType);
}
}
if (!errorTypes.isEmpty()) {
Collection<String> errorTypeNames = getTypeNames(errorTypes);
Collection<String> notExtendingTypeNames = getTypeNames(notExtendingTypes);
failWithMessage("Expected element type <%s> to be not extended by types <%s> but is extended by <%s>", typeName, notExtendingTypeNames, errorTypeNames);
}
return this;
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelElementTypeAssert method extendsNoType.
public ModelElementTypeAssert extendsNoType() {
isNotNull();
ModelElementType actualBaseType = actual.getBaseType();
if (actualBaseType != null) {
failWithMessage("Expected element type <%s> to not extend any type but extends <%s>", typeName, actualBaseType.getTypeName());
}
return this;
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class ModelTest method testGetTypeForName.
@Test
public void testGetTypeForName() {
ModelElementType birdType = model.getTypeForName(ELEMENT_NAME_BIRD);
assertThat(birdType).isNull();
birdType = model.getTypeForName(MODEL_NAMESPACE, ELEMENT_NAME_BIRD);
assertThat(birdType.getInstanceType()).isEqualTo(Bird.class);
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class UnknownAnimalTest method testGetUnknownAnimalByType.
@Test
public void testGetUnknownAnimalByType() {
ModelInstanceImpl modelInstanceImpl = (ModelInstanceImpl) modelInstance;
ModelElementType unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal");
List<ModelElementInstance> unknownAnimals = new ArrayList<ModelElementInstance>(modelInstance.getModelElementsByType(unknownAnimalType));
assertThat(unknownAnimals).hasSize(2);
ModelElementInstance wanda = unknownAnimals.get(0);
assertThat(wanda.getAttributeValue("id")).isEqualTo("wanda");
assertThat(wanda.getAttributeValue("gender")).isEqualTo("Female");
assertThat(wanda.getAttributeValue("species")).isEqualTo("fish");
ModelElementInstance flipper = unknownAnimals.get(1);
assertThat(flipper.getAttributeValue("id")).isEqualTo("flipper");
assertThat(flipper.getAttributeValue("gender")).isEqualTo("Male");
assertThat(flipper.getAttributeValue("species")).isEqualTo("dolphin");
}
use of org.camunda.bpm.model.xml.type.ModelElementType in project camunda-xml-model by camunda.
the class AttributeTest method testOwningElementType.
@Test
public void testOwningElementType() {
ModelElementType animalType = modelInstance.getModel().getType(Animal.class);
assertThat(idAttribute).hasOwningElementType(animalType);
assertThat(nameAttribute).hasOwningElementType(animalType);
assertThat(fatherAttribute).hasOwningElementType(animalType);
}
Aggregations