use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testMultipleFiltersWithPlus.
@Test
public void testMultipleFiltersWithPlus() {
QueryParameters query = QueryParameters.query("where=username:eq:'test test'+lastname:gte:gale").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(2, 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());
Assert.assertEquals("lastname", query.getFilters().get(1).getField());
Assert.assertNotNull(query.getFilters().get(1).getOperation());
Assert.assertEquals(FilterOperation.GTE, query.getFilters().get(1).getOperation());
Assert.assertEquals("gale", query.getFilters().get(1).getValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testUriEncoded.
@Test
public void testUriEncoded() {
QueryParameters query = QueryParameters.uriEncoded("api.github" + ".com/tfaga/repos?where=firstname:like:Kar%25%20").build();
Boolean a = Boolean.parseBoolean("asdadas");
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 testMultipleKeyFilters.
@Test
public void testMultipleKeyFilters() {
QueryParameters query = QueryParameters.query("where=username:eq:'test test' " + "lastname:gte:gale&filter=country:neq:SI").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.NEQ, query.getFilters().get(0).getOperation());
Assert.assertEquals("SI", query.getFilters().get(0).getValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testQuotesInNinicFilter.
@Test
public void testQuotesInNinicFilter() {
QueryParameters query = QueryParameters.query("where=country:ninic:['Czech Republic','United States']").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.NINIC, 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("United States", query.getFilters().get(0).getValues().get(1));
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderFiltersTest method testDisabledFilters.
@Test
public void testDisabledFilters() {
QueryParameters query = QueryParameters.query("filter=username:eq:test").enableFilters(false).build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFilters());
Assert.assertEquals(0, query.getFilters().size());
}
Aggregations