use of org.activityinfo.model.formTree.TestBatchFormClassProvider in project activityinfo by bedatadriven.
the class FormulaValidatorTest method invalidFormSchema.
@Test
public void invalidFormSchema() {
FormClass formClass = new FormClass(ResourceId.valueOf("XYZ"));
formClass.addField(ResourceId.valueOf("F1")).setCode("A").setLabel("Field A1").setType(TextType.SIMPLE);
formClass.addField(ResourceId.valueOf("F2")).setCode("A").setLabel("Field A2").setType(TextType.SIMPLE);
TestBatchFormClassProvider formProvider = new TestBatchFormClassProvider();
formProvider.add(formClass);
FormTreeBuilder formTreeBuilder = new FormTreeBuilder(formProvider);
FormTree formTree = formTreeBuilder.queryTree(formClass.getId());
FormulaValidator validator = new FormulaValidator(formTree);
assertFalse(validator.validate(FormulaParser.parse("A")));
assertThat(validator.getErrors(), hasSize(1));
}
use of org.activityinfo.model.formTree.TestBatchFormClassProvider in project activityinfo by bedatadriven.
the class SchemaCsvWriterV3Test method setup.
@Before
public void setup() throws IOException {
LocaleProxy.initialize();
database = new UserDatabaseDTO(1, "Survey DB");
formClassProvider = new TestBatchFormClassProvider();
setupSurveyForm();
setupMonthly();
expectedSurveyExport = readExport("survey.csv");
}
Aggregations