use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method andNull.
@Test
public void andNull() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.allOf(builder.attribute(FOO_ATTRIBUTE).is().empty());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(And.class), anyObject());
inOrder.verify(visitor).visit(isA(PropertyIsNull.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method like.
@Test
public void like() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).is().like().text("bar");
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(PropertyIsLike.class), anyObject());
// TODO check case sensitivity
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method andOrNull.
@Test
public void andOrNull() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
// FilterBuilder builder = new GeotoolsFilterBuilder();
//
//
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.allOf(builder.anyOf(builder.attribute(FOO_ATTRIBUTE).is().empty()));
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(And.class), anyObject());
inOrder.verify(visitor).visit(isA(Or.class), anyObject());
ArgumentCaptor<PropertyIsNull> propertyIsNullArgument = ArgumentCaptor.forClass(PropertyIsNull.class);
verify(visitor).visit(propertyIsNullArgument.capture(), anyObject());
ExpressionVisitor expVisitor = spy(new DefaultExpressionVisitor() {
});
propertyIsNullArgument.getValue().getExpression().accept(expVisitor, null);
ArgumentCaptor<PropertyName> propertyNameArgument = ArgumentCaptor.forClass(PropertyName.class);
verify(expVisitor).visit(propertyNameArgument.capture(), anyObject());
assertEquals(FOO_ATTRIBUTE, propertyNameArgument.getValue().getPropertyName());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorWithinNull.
@Test(expected = IllegalArgumentException.class)
public void operatorWithinNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").within().wkt(null);
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method propertyIsNotEqual.
@Test
public void propertyIsNotEqual() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).notEqualTo().text("bar");
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().notEqualTo().text("bar");
filter.accept(visitor, null);
filter = builder.attribute(null).is().notEqualTo().text(null);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(3)).visit(isA(PropertyIsNotEqualTo.class), anyObject());
}
Aggregations