Search in sources :

Example 1 with ParsedFormula

use of org.activityinfo.analysis.ParsedFormula in project activityinfo by bedatadriven.

the class LookupKeySetTest method overlappingHierarchiesParse.

@Test
public void overlappingHierarchiesParse() {
    TestingStorageProvider catalog = setup.getCatalog();
    LocaliteForm localiteForm = catalog.getLocaliteForm();
    FormTree formTree = setup.getFormTree(localiteForm.getFormId());
    LookupKeySet lookupKeySet = new LookupKeySet(formTree, localiteForm.getAdminField());
    Map<LookupKey, FormulaNode> formulas = lookupKeySet.getKeyFormulas(localiteForm.getAdminField().getId());
    ParsedFormula province = new ParsedFormula(formTree, formulas.get(lookupKeySet.getKey(0)).asExpression());
    assertThat(province.isValid(), equalTo(true));
    assertThat(province.getResultType(), instanceOf(TextType.class));
}
Also used : ParsedFormula(org.activityinfo.analysis.ParsedFormula) LookupKeySet(org.activityinfo.model.formTree.LookupKeySet) FormulaNode(org.activityinfo.model.formula.FormulaNode) FormTree(org.activityinfo.model.formTree.FormTree) LookupKey(org.activityinfo.model.formTree.LookupKey) TextType(org.activityinfo.model.type.primitive.TextType) Test(org.junit.Test)

Aggregations

ParsedFormula (org.activityinfo.analysis.ParsedFormula)1 FormTree (org.activityinfo.model.formTree.FormTree)1 LookupKey (org.activityinfo.model.formTree.LookupKey)1 LookupKeySet (org.activityinfo.model.formTree.LookupKeySet)1 FormulaNode (org.activityinfo.model.formula.FormulaNode)1 TextType (org.activityinfo.model.type.primitive.TextType)1 Test (org.junit.Test)1