SortOrder implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof SortOrder)) { return false; } SortOrder that = (SortOrder) obj; return Objects.equals(this.direction, that.direction) && Objects.equals(this.property, that.property); } SortOrder(String property, Direction direction);  SortOrder(String property); Direction getDirection(); String getProperty(); boolean isAscending(); SortOrder withDirection(Direction direction); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() { SortOrder order1 = new SortOrder("test"); SortOrder order2 = new SortOrder("test"); SortOrder order3 = new SortOrder("test", Direction.DESC); assertFalse(order1.equals(null)); assertFalse(order1.equals(new Object())); assertTrue(order1.equals(order1)); assertTrue(order1.equals(order2)); assertFalse(order1.equals(order3)); }