Search in sources :

Example 36 with QueryParameters

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

the class QueryStringBuilderFieldsTest method testEnabledFields.

@Test
public void testEnabledFields() {
    QueryParameters query = QueryParameters.query("fields=username,firstname,lastname").enableFields(true).build();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(3, query.getFields().size());
    Assert.assertEquals("username", query.getFields().get(0));
    Assert.assertEquals("firstname", query.getFields().get(1));
    Assert.assertEquals("lastname", query.getFields().get(2));
    query = QueryParameters.query("fields=username,firstname,lastname").build();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(3, query.getFields().size());
    Assert.assertEquals("username", query.getFields().get(0));
    Assert.assertEquals("firstname", query.getFields().get(1));
    Assert.assertEquals("lastname", query.getFields().get(2));
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 37 with QueryParameters

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

the class QueryStringBuilderFieldsTest method testQueryFieldsObject.

@Test
public void testQueryFieldsObject() {
    QueryParameters query = new QueryParameters();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(0, query.getFields().size());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 38 with QueryParameters

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

the class QueryStringBuilderFieldsTest method testDuplicateFields.

@Test
public void testDuplicateFields() {
    QueryParameters query = QueryParameters.query("select=country,firstname,country").build();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(2, query.getFields().size());
    Assert.assertEquals("country", query.getFields().get(0));
    Assert.assertEquals("firstname", query.getFields().get(1));
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 39 with QueryParameters

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

the class QueryStringBuilderFieldsTest method testDisabledFields.

@Test
public void testDisabledFields() {
    QueryParameters query = QueryParameters.query("fields=username,firstname,lastname").enableFields(false).build();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(0, query.getFields().size());
}
Also used : QueryParameters(com.github.tfaga.lynx.beans.QueryParameters) Test(org.junit.Test)

Example 40 with QueryParameters

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

the class QueryStringBuilderFieldsTest method testEmptyField.

@Test
public void testEmptyField() {
    QueryParameters query = QueryParameters.query("fields=").build();
    Assert.assertNotNull(query);
    Assert.assertNotNull(query.getFields());
    Assert.assertEquals(0, query.getFields().size());
}
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