### Question:
Sorts { public List<Sort> asList() { return sorts; } Sorts(String orders, AttributeConverter converter);  Sorts(String orders); List<Sort> asList();  }### Answer:
@Test public void testNullSortListing() throws Exception { Sorts sorts = new Sorts(null); List<Sort> sortList = sorts.asList(); Assert.assertTrue(sortList.isEmpty()); }
@Test public void testEmptySortListing() throws Exception { Sorts sorts = new Sorts(""); List<Sort> sortList = sorts.asList(); Assert.assertTrue(sortList.isEmpty()); }
@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)); }
@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)); }