use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testNinFilter.
@Test
public void testNinFilter() {
QueryParameters query = QueryParameters.query("where=username:nin:[garryz,johnf,johng]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.NIN, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
Assert.assertEquals(3, query.getFilters().get(0).getValues().size());
Assert.assertEquals("garryz", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("johnf", query.getFilters().get(0).getValues().get(1));
Assert.assertEquals("johng", query.getFilters().get(0).getValues().get(2));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testInicFilter.
@Test
public void testInicFilter() {
QueryParameters query = QueryParameters.query("where=username:inic:[Garryz,johnF]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.INIC, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
Assert.assertEquals(2, query.getFilters().get(0).getValues().size());
Assert.assertEquals("Garryz", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("johnF", query.getFilters().get(0).getValues().get(1));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testMalformedBinaryFilter.
@Test
public void testMalformedBinaryFilter() {
QueryParameters query = QueryParameters.query("filter=usernameeq:eq test").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(0, query.getFilters().size());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testEnabledFilters.
@Test
public void testEnabledFilters() {
QueryParameters query = QueryParameters.query("filter=username:eq:test").enableFilters(true).build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertNotNull(query.getFilters().get(0));
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertEquals(FilterOperation.EQ, query.getFilters().get(0).getOperation());
Assert.assertEquals("test", query.getFilters().get(0).getValue());
query = QueryParameters.query("filter=username:eq:test").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertNotNull(query.getFilters().get(0));
Assert.assertEquals("username", query.getFilters().get(0).getField());
Assert.assertEquals(FilterOperation.EQ, query.getFilters().get(0).getOperation());
Assert.assertEquals("test", query.getFilters().get(0).getValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testIsNullFilter.
@Test
public void testIsNullFilter() {
QueryParameters query = QueryParameters.query("where=description:isnull").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("description", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.ISNULL, query.getFilters().get(0).getOperation());
Assert.assertNull(query.getFilters().get(0).getValue());
}
Aggregations