use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorAfterNull.
@Test(expected = IllegalArgumentException.class)
public void operatorAfterNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").after().date(null);
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method before.
@Test
public void before() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).before().date(new Date());
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().before().date(new Date());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(2)).visit(isA(Before.class), any());
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class CopyFilterDelegateTest method testExcludeFilter.
@Test
public void testExcludeFilter() {
Filter filterIn = Filter.EXCLUDE;
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
Filter filterCopy = null;
try {
filterCopy = fa.adapt(filterIn, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
assertNotNull(filterCopy);
assertSame(filterIn, filterCopy);
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class CopyFilterDelegateTest method assertFilterException.
private void assertFilterException(Filter filterIn) {
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
// the UnsupportedQueryException thrown by the FilterAdapter.
try {
fa.adapt(filterIn, delegate);
fail("Should have gotten an UnsupportedQueryException");
} catch (UnsupportedQueryException e) {
assertTrue(e.getCause() instanceof UnsupportedOperationException);
}
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class CopyFilterDelegateTest method testIncludeFilter.
@Test
public void testIncludeFilter() {
Filter filterIn = Filter.INCLUDE;
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
Filter filterCopy = null;
try {
filterCopy = fa.adapt(filterIn, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
assertNotNull(filterCopy);
assertSame(filterIn, filterCopy);
}
Aggregations