Example #1
0
  @Test
  public void testSingleSortListing() throws Exception {
    Sorts sorts = new Sorts("attribute " + Order.ASC);

    List<Sort> sortList = sorts.asList();

    Assert.assertEquals(new Sort("attribute " + Order.ASC), sortList.get(0));
  }
Example #2
0
  @Test
  public void testEmptySortListing() throws Exception {
    Sorts sorts = new Sorts("");

    List<Sort> sortList = sorts.asList();

    Assert.assertTrue(sortList.isEmpty());
  }
Example #3
0
  @Test
  public void testMultipleSortListing() throws Exception {
    String attribute1Order = "attribute1 " + Order.ASC;
    String attribute2Order = "attribute2 " + Order.DESC;
    Sorts sorts = new Sorts(attribute1Order + "," + attribute2Order);

    List<Sort> sortList = sorts.asList();

    Assert.assertEquals(new Sort(attribute1Order), sortList.get(0));
    Assert.assertEquals(new Sort(attribute2Order), sortList.get(1));
  }