use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testSingleFilter.
@Test
public void testSingleFilter() {
QueryParameters query = QueryParameters.query("filter=username:eq:test").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.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 testQueryDecoded.
@Test
public void testQueryDecoded() {
QueryParameters query = QueryParameters.query("where=firstname:like:Kar%").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("firstname", query.getFilters().get(0).getField());
Assert.assertNotNull(query.getFilters().get(0).getOperation());
Assert.assertEquals(FilterOperation.LIKE, query.getFilters().get(0).getOperation());
Assert.assertEquals("Kar%", query.getFilters().get(0).getValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testSingleFilterWithQuotes.
@Test
public void testSingleFilterWithQuotes() {
QueryParameters query = QueryParameters.query("filter=username:eq:'test test'").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.EQ, query.getFilters().get(0).getOperation());
Assert.assertEquals("test test", query.getFilters().get(0).getValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testQuotesInNinFilter.
@Test
public void testQuotesInNinFilter() {
QueryParameters query = QueryParameters.query("where=country:nin:['Czech Republic',Nigeria]").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(1, query.getFilters().size());
Assert.assertEquals("country", 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(2, query.getFilters().get(0).getValues().size());
Assert.assertEquals("Czech Republic", query.getFilters().get(0).getValues().get(0));
Assert.assertEquals("Nigeria", query.getFilters().get(0).getValues().get(1));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testArrayValueWhenNotInOperation.
@Test
public void testArrayValueWhenNotInOperation() {
QueryParameters query = QueryParameters.query("where=username:neq:[johnf,garryz]").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.NEQ, query.getFilters().get(0).getOperation());
Assert.assertEquals("[johnf,garryz]", query.getFilters().get(0).getValue());
}
Aggregations