SortCriterionImpl implements SortCriterion { @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof SortCriterionImpl)) return false; SortCriterionImpl that = (SortCriterionImpl) o; return Objects.equals(this.fieldName, that.fieldName) && Objects.equals(this.order, that.order); } 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 testEquals() { assertTrue(orderByNameAsc.equals(new SortCriterionImpl("name", Order.Ascending))); }