DirtyState implements Serializable { @Override public boolean equals(@Nullable Object object) { if (object instanceof DirtyState) { DirtyState dirtyState = (DirtyState) object; return Objects.equals(dirty.get(), dirtyState.dirty.get()); } return false; }  void afterModification(); boolean beforeCommit(); void afterCommit(); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void testEquals() { DirtyState dirtyState = new DirtyState(); DirtyState equal = new DirtyState(); Assert.assertEquals(dirtyState, equal); Assert.assertEquals(dirtyState.hashCode(), equal.hashCode()); }