Search in sources :

Example 1 with NotNode

use of com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.logical.NotNode in project hale by halestudio.

the class TestCqlToMappingConditionTranslator method testTranslateNegatedEquality.

/**
 * Tests translating a CQL expression that negates the result of a simple
 * equality filter.
 *
 * @throws TranslationException
 *             if any errors occurred during the translation
 * @throws CQLException
 *             if any errors occurred parsing the CQL string
 */
@Test
public void testTranslateNegatedEquality() throws CQLException, TranslationException {
    // $NON-NLS-1$
    String cqlPredicate = "ATTR1 <> '17'";
    ModelMappingCondition result = digester.translate(CQL.toFilter(cqlPredicate));
    assertNotNull(result);
    assertNotNull(result.getRoot());
    assertThat(result.getRoot(), is(instanceOf(NotNode.class)));
    NotNode notNode = (NotNode) result.getRoot();
    assertThat(notNode.getChildren().size(), is(equalTo(1)));
    assertThat(notNode.getChild(0), is(instanceOf(EqualToNode.class)));
    EqualToNode equalNode = (EqualToNode) notNode.getChild(0);
    assertThat(equalNode.getChildren().size(), is(equalTo(0)));
    // $NON-NLS-1$ //$NON-NLS-2$
    checkComparisonRightLiteral(equalNode, "ATTR1", "17");
}
Also used : EqualToNode(com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.comparison.EqualToNode) NotNode(com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.logical.NotNode) ModelMappingCondition(com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelMappingCondition) Test(org.junit.Test)

Aggregations

ModelMappingCondition (com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelMappingCondition)1 EqualToNode (com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.comparison.EqualToNode)1 NotNode (com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.logical.NotNode)1 Test (org.junit.Test)1