use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderOrderTest method testSingleOrder.
@Test
public void testSingleOrder() {
QueryParameters query = QueryParameters.query("order=username DESC").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getOrder());
Assert.assertEquals(1, query.getOrder().size());
Assert.assertEquals("username", query.getOrder().get(0).getField());
Assert.assertNotNull(query.getOrder().get(0).getOrder());
Assert.assertEquals(OrderDirection.DESC, query.getOrder().get(0).getOrder());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderOrderTest method testDisabledOrder.
@Test
public void testDisabledOrder() {
QueryParameters query = QueryParameters.query("order=username DESC").enableOrder(false).build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getOrder());
Assert.assertEquals(0, query.getOrder().size());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderOrderTest method testMultipleOrdersWithEmptyBetween.
@Test
public void testMultipleOrdersWithEmptyBetween() {
QueryParameters query = QueryParameters.query("order=username,,,,firstname DESC").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getOrder());
Assert.assertEquals(2, query.getOrder().size());
Assert.assertEquals("username", query.getOrder().get(0).getField());
Assert.assertNotNull(query.getOrder().get(0).getOrder());
Assert.assertEquals(OrderDirection.ASC, query.getOrder().get(0).getOrder());
Assert.assertEquals("firstname", query.getOrder().get(1).getField());
Assert.assertNotNull(query.getOrder().get(1).getOrder());
Assert.assertEquals(OrderDirection.DESC, query.getOrder().get(1).getOrder());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderOrderTest method testOrderWithoutDirection.
@Test
public void testOrderWithoutDirection() {
QueryParameters query = QueryParameters.query("sort=username").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getOrder());
Assert.assertEquals(1, query.getOrder().size());
Assert.assertEquals("username", query.getOrder().get(0).getField());
Assert.assertNotNull(query.getOrder().get(0).getOrder());
Assert.assertEquals(OrderDirection.ASC, query.getOrder().get(0).getOrder());
}
use of com.github.tfaga.lynx.beans.QueryParameters in project lynx by TFaga.
the class QueryStringBuilderOrderTest method testMultipleOrderRepeatFields.
@Test
public void testMultipleOrderRepeatFields() {
QueryParameters query = QueryParameters.query("order=username,firstname,username DESC").build();
Assert.assertNotNull(query);
Assert.assertNotNull(query.getOrder());
Assert.assertEquals(2, query.getOrder().size());
Assert.assertEquals("username", query.getOrder().get(0).getField());
Assert.assertNotNull(query.getOrder().get(0).getOrder());
Assert.assertEquals(OrderDirection.ASC, query.getOrder().get(0).getOrder());
Assert.assertEquals("firstname", query.getOrder().get(1).getField());
Assert.assertNotNull(query.getOrder().get(1).getOrder());
Assert.assertEquals(OrderDirection.ASC, query.getOrder().get(1).getOrder());
}
Aggregations