Search in sources :

Example 56 with QueryParameters

use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.

the class QueryStringBuilderPagingTest method testEmptyLimit.

@Test
public void testEmptyLimit() {
    QueryParameters query = QueryParameters.query("limit=").build();
    Assert.assertNotNull(query);
    Assert.assertNull(query.getLimit());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 57 with QueryParameters

use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.

the class QueryStringBuilderPagingTest method testLimitUriWithFragment.

@Test
public void testLimitUriWithFragment() {
    QueryParameters query = QueryParameters.uri("api.github.com/tfaga/repos?limit=123#header1").build();
    Assert.assertNotNull(query.getLimit());
    Assert.assertEquals(123, query.getLimit().longValue());
    query = QueryParameters.uri("api.github.com/tfaga/repos#header2?skip=98172").build();
    Assert.assertNull(query.getLimit());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 58 with QueryParameters

use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.

the class QueryStringBuilderPagingTest method testOffsetUri.

@Test
public void testOffsetUri() {
    QueryParameters query = QueryParameters.uri("api.github.com/tfaga/repos?skip=98172").build();
    Assert.assertNotNull(query.getOffset());
    Assert.assertEquals(98172, query.getOffset().longValue());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 59 with QueryParameters

use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.

the class QueryStringBuilderPagingTest method testMaxLimit.

@Test
public void testMaxLimit() {
    QueryParameters query = QueryParameters.query("limit=321").maxLimit(200).build();
    Assert.assertNotNull(query.getLimit());
    Assert.assertEquals(200, query.getLimit().longValue());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 60 with QueryParameters

use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.

the class QueryStringBuilderPagingTest method testOffset.

@Test
public void testOffset() {
    QueryParameters query = QueryParameters.query("offset=921").build();
    Assert.assertNotNull(query.getOffset());
    Assert.assertEquals(921, query.getOffset().longValue());
    query = QueryParameters.query("skip=824").build();
    Assert.assertNotNull(query.getOffset());
    Assert.assertEquals(824, query.getOffset().longValue());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Aggregations

QueryParameters (com.github.tfaga.lynx.beans.QueryParameters)158 Test (org.junit.Test)155 User (com.github.tfaga.lynx.test.entities.User)46 QueryFilter (com.github.tfaga.lynx.beans.QueryFilter)44 QueryStringDefaults (com.github.tfaga.lynx.utils.QueryStringDefaults)14 QueryOrder (com.github.tfaga.lynx.beans.QueryOrder)13 Project (com.github.tfaga.lynx.test.entities.Project)12 NoSuchEntityFieldException (com.github.tfaga.lynx.exceptions.NoSuchEntityFieldException)6 Date (java.util.Date)6 URI (java.net.URI)4 CriteriaField (com.github.tfaga.lynx.beans.CriteriaField)2 CriteriaWhereQuery (com.github.tfaga.lynx.beans.CriteriaWhereQuery)2 OrderDirection (com.github.tfaga.lynx.enums.OrderDirection)2 InvalidEntityFieldException (com.github.tfaga.lynx.exceptions.InvalidEntityFieldException)2 InvalidFieldValueException (com.github.tfaga.lynx.exceptions.InvalidFieldValueException)2 CriteriaFilter (com.github.tfaga.lynx.interfaces.CriteriaFilter)2 Field (java.lang.reflect.Field)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ZonedDateTime (java.time.ZonedDateTime)2 DateTimeParseException (java.time.format.DateTimeParseException)2