use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderPagingTest method testOffsetUriObject.
@Test
public void testOffsetUriObject() throws URISyntaxException {
URI uri = new URI("api.github.com/tfaga/repos?offset=12312");
QueryParameters query = QueryParameters.uri(uri).build();
Assert.assertNotNull(query.getOffset());
Assert.assertEquals(12312, query.getOffset().longValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderPagingTest method testDefaultOffset.
@Test
public void testDefaultOffset() {
QueryParameters query = QueryParameters.query("limit=321").defaultOffset(0).build();
Assert.assertNotNull(query.getLimit());
Assert.assertNotNull(query.getOffset());
Assert.assertEquals(321, query.getLimit().longValue());
Assert.assertEquals(0, query.getOffset().longValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderPagingTest method testLimit.
@Test
public void testLimit() {
QueryParameters query = QueryParameters.query("limit=123").build();
Assert.assertNotNull(query.getLimit());
Assert.assertEquals(123, query.getLimit().longValue());
query = QueryParameters.query("max=321").build();
Assert.assertNotNull(query.getLimit());
Assert.assertEquals(321, query.getLimit().longValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringDefaultsTest method testEnabledPagination.
@Test
public void testEnabledPagination() {
QueryParameters query = new QueryStringDefaults().enablePagination(true).builder().query("limit=100&offset=200").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getLimit());
Assert.assertNotNull(query.getOffset());
Assert.assertEquals(100, query.getLimit().longValue());
Assert.assertEquals(200, query.getOffset().longValue());
query = new QueryStringDefaults().builder().query("limit=100&offset=200").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getLimit());
Assert.assertNotNull(query.getOffset());
Assert.assertEquals(100, query.getLimit().longValue());
Assert.assertEquals(200, query.getOffset().longValue());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringDefaultsTest method testEnabledFields.
@Test
public void testEnabledFields() {
QueryParameters query = new QueryStringDefaults().enableFields(true).builder().query("fields=name,email").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFields());
Assert.assertEquals(2, query.getFields().size());
Assert.assertEquals("name", query.getFields().get(0));
Assert.assertEquals("email", query.getFields().get(1));
query = new QueryStringDefaults().builder().query("fields=name,email").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getFields());
Assert.assertEquals(2, query.getFields().size());
Assert.assertEquals("name", query.getFields().get(0));
Assert.assertEquals("email", query.getFields().get(1));
}
Aggregations