Group20Entry extends AbstractEntry { @Override @JsonIgnore public void sortEntryCollection(String sort) { if (StringUtils.isNotBlank(sort) && SORT_ATR.contains(sort)) { BeanComparator beanComparator = new BeanComparator(sort, NULL_SAFE_STRING_COMPARATOR); Collections.sort(entry, beanComparator); } } Group20Entry(List<Group20> groups);  Group20Entry();  Group20Entry(List<Group20> groups, int pageSize, int offset, String sortBy, int rowCount); List<Group20> getEntry(); void setEntry(List<Group20> entry); @Override int getEntrySize(); @Override @JsonIgnore List getEntryCollection(); @Override @JsonIgnore void sortEntryCollection(String sort); @Override @JsonIgnore void setEntryCollection(List entry); @Override String toString(); @JsonIgnore
  static List<String> SORT_ATR; @JsonIgnore
  static Comparator NULL_SAFE_STRING_COMPARATOR; }
@SuppressWarnings("unchecked") @Test public void testSortEntryCollection() { Group20Entry entry = new Group20Entry(Arrays.asList(new Group20("id2", "c", "description1"), new Group20("id1", "B", null), new Group20("id1", "a", null))); entry.sortEntryCollection(null); assertEquals("id2", ((Group20) entry.getEntryCollection().get(0)).getId()); entry.sortEntryCollection("id"); assertEquals("id1", ((Group20) entry.getEntryCollection().get(0)).getId()); entry.sortEntryCollection("description"); assertNull(((Group20) entry.getEntryCollection().get(0)).getDescription()); entry.sortEntryCollection("title"); List<Group20> groups = entry.getEntryCollection(); assertEquals("a", groups.get(0).getTitle()); assertEquals("B", groups.get(1).getTitle()); assertEquals("c", groups.get(2).getTitle()); }