SortCriterionImpl implements SortCriterion { @Override public String toString() { if (order.equals(Order.Ascending)) return fieldName + ":ASC"; if (order.equals(Order.Descending)) return fieldName + ":DESC"; return fieldName + ":NONE"; } SortCriterionImpl(String fieldName, Order order); static SortCriterionImpl parse(final String sortCriterion); @Override String getFieldName(); @Override Order getOrder(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testToString() { assertEquals("name:ASC", orderByNameAsc.toString()); assertEquals("date:DESC", orderByDateDesc.toString()); }