use of org.apache.cayenne.unit.util.TstBean in project cayenne by apache.
the class OrderingTest method testOrderedList.
@Test
public void testOrderedList() {
Collection<TstBean> set = new HashSet<>(6);
TstBean shouldBe0 = new TstBean("a", 0);
TstBean shouldBe1 = new TstBean("b", 0);
TstBean shouldBe2 = new TstBean("c", 0);
TstBean shouldBe3 = new TstBean("d", 0);
TstBean shouldBe4 = new TstBean("f", 0);
TstBean shouldBe5 = new TstBean("r", 0);
set.add(shouldBe1);
set.add(shouldBe0);
set.add(shouldBe5);
set.add(shouldBe3);
set.add(shouldBe2);
set.add(shouldBe4);
List<TstBean> orderedList = new Ordering("string", SortOrder.ASCENDING).orderedList(set);
assertEquals(shouldBe0, orderedList.get(0));
assertEquals(shouldBe1, orderedList.get(1));
assertEquals(shouldBe2, orderedList.get(2));
assertEquals(shouldBe3, orderedList.get(3));
assertEquals(shouldBe4, orderedList.get(4));
assertEquals(shouldBe5, orderedList.get(5));
}
Aggregations