use of org.activityinfo.model.form.FormSection in project activityinfo by bedatadriven.
the class CloneDatabaseTest method assertFormClass.
private void assertFormClass(FormClass sourceFormClass, FormClass targetFormClass) {
assertNotEquals(sourceFormClass.getId(), targetFormClass.getId());
assertEquals(sourceFormClass.getLabel(), targetFormClass.getLabel());
assertEquals(sourceFormClass.getDescription(), targetFormClass.getDescription());
// fields
for (FormField sourceField : sourceFormClass.getFields()) {
FormField targetField = (FormField) elementByName(targetFormClass.getElements(), sourceField.getLabel());
assertNotEquals(sourceField.getId(), targetField.getId());
assertEquals(sourceField.getDescription(), targetField.getDescription());
assertEquals(sourceField.getCode(), targetField.getCode());
assertEquals(sourceField.getRelevanceConditionExpression(), targetField.getRelevanceConditionExpression());
assertEquals(sourceField.getType().getTypeClass(), targetField.getType().getTypeClass());
// todo
if (sourceField.getType() instanceof ReferenceType) {
// need something more sophisticated to check equality of ReferenceType
} else if (sourceField.getType() instanceof EnumType) {
// need something more sophisticated to check equality of ReferenceType
}
}
// sections
for (FormSection sourceSection : sourceFormClass.getSections()) {
FormSection targetSection = (FormSection) elementByName(targetFormClass.getElements(), sourceSection.getLabel());
assertNotEquals(sourceSection.getId(), targetSection.getId());
assertEquals(sourceSection.getLabel(), targetSection.getLabel());
}
}
Aggregations