### Question:
CQL { public static Filter toFilter(final String cqlPredicate) throws CQLException { Filter filter = CQL.toFilter(cqlPredicate, null); return filter; } private  CQL(); static Filter toFilter(final String cqlPredicate); static Filter toFilter(final String cqlPredicate, final FilterFactory filterFactory); static Expression toExpression(String cqlExpression); static Expression toExpression(final String cqlExpression,
                                          final FilterFactory filterFactory); static List<Filter> toFilterList(final String cqlFilterList); static String toCQL( Filter filter ); static String toCQL( Expression expression ); static List<Filter> toFilterList(final String cqlSequencePredicate, final FilterFactory filterFactory); static final void main(String[] args);  }### Answer:
@Test public void betweenPredicate() throws CQLException{ Filter filter = CQL.toFilter("QUANTITY BETWEEN 10 AND 20"); Assert.assertTrue(filter instanceof PropertyIsBetween); }
@Test public void comparisonPredicate() throws Exception{ Filter filter; filter = CQL.toFilter("POP_RANK > 6"); Assert.assertTrue(filter instanceof PropertyIsGreaterThan); }
@Test public void geoOperationPredicate() throws CQLException{ Filter filter; filter = CQL.toFilter("DISJOINT(the_geom, POINT(1 2))"); Assert.assertTrue("Disjoint was expected", filter instanceof Disjoint); }
@Test public void functionDwithinGeometry() throws Exception{ Filter resultFilter; resultFilter = CQL.toFilter( "DWITHIN(the_geom, POINT(1 2), 10, kilometers)"); Assert.assertTrue(resultFilter instanceof DistanceBufferOperator); }
@Test public void temporalPredicate() throws Exception{ Filter filter = CQL.toFilter("DATE BEFORE 2006-12-31T01:30:00Z"); Assert.assertTrue( filter instanceof PropertyIsLessThan); }
@Test public void booleanPredicate() throws Exception{ Filter filter; filter = CQL.toFilter("QUANTITY < 10 AND QUANTITY < 2 "); Assert.assertTrue(filter instanceof And); filter = CQL.toFilter("QUANTITY < 10 OR QUANTITY < 2 "); Assert.assertTrue(filter instanceof Or); filter = CQL.toFilter("NOT QUANTITY < 10"); Assert.assertTrue(filter instanceof Not); }
@Test public void likePredicate() throws Exception{ Filter filter = CQL.toFilter("NAME like '%new%'"); Assert.assertTrue(filter instanceof PropertyIsLike); }
@Test public void isNullPredicate() throws Exception { Filter filter = CQL.toFilter("SHAPE IS NULL"); Assert.assertTrue(filter instanceof IsNullImpl); }
@Test public void existProperty() throws Exception{ Filter resultFilter = CQL.toFilter("NAME EXISTS"); Assert.assertTrue(resultFilter instanceof PropertyIsEqualTo); PropertyIsEqualTo eq = (PropertyIsEqualTo) resultFilter; Expression expr = eq.getExpression1() ; Assert.assertTrue(expr instanceof PropertyExistsFunction); }
@Test public void toFilterUsesProvidedFilterFactory() throws Exception { final boolean[] called = { false }; FilterFactory ff = new FilterFactoryImpl() { public PropertyName property(String propName) { called[0] = true; return super.property(propName); } }; CQL.toFilter("attName > 20", ff); Assert.assertTrue("Provided FilterFactory was not called", called[0]); }