### Question:
JpaEntity implements IdentifiableEntity<ID> { @Override public boolean equals(Object o) { if (this == o) return true; if (!getClass().isInstance(o)) return false; return getId() != null && getId().equals(((JpaEntity) o).getId()); }  @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void equals() { Model model1 = new Model(null); Model model2 = new Model(null); assertThat(model1).isNotEqualTo(model2); model1.setId(1); model2.setId(1); assertThat(model1).isEqualTo(model2); }
@SuppressWarnings("EqualsWithItself") @Test public void reflexive() { assertThat(x.equals(x)).isTrue(); }
@Test public void symmetric() { assertThat(x.equals(y)).isTrue(); assertThat(y.equals(x)).isTrue(); }
@Test public void transitive() { assertThat(x.equals(y)).isTrue(); assertThat(y.equals(z)).isTrue(); assertThat(z.equals(x)).isTrue(); }
@Test public void consistence() { for (int i = 0; i < 1000; i++) { assertThat(x.equals(y)).isTrue(); } }
@SuppressWarnings("ConstantConditions") @Test public void nullComparison() { assertThat(new Model(null).equals(null)).isFalse(); assertThat(new Model(0).equals(null)).isFalse(); assertThat(new Model(Integer.MIN_VALUE).equals(null)).isFalse(); assertThat(new Model(Integer.MAX_VALUE).equals(null)).isFalse(); }
@Test public void comparisonWithProxy() { Model model = new Model(1); Model proxy = (Model) Enhancer.create( Model.class, (MethodInterceptor) (object, method, args, methodProxy) -> methodProxy.invoke(model, args) ); assertThat(model.equals(proxy)).isTrue(); }