@Test void testEquals() { Id id = Id.getProvider().fromLong(17L); PersistentEObject o0 = new DefaultPersistentEObject(id); PersistentEObject o1 = new DefaultPersistentEObject(id); PersistentEObject o2 = new DefaultPersistentEObject(); assertThat(o0).isEqualTo(o1); assertThat(o0).isNotEqualTo(o2); assertThat(o1).isNotEqualTo(o2); assertThat(o0).isEqualTo(o0); assertThat(o0).isNotEqualTo(null); assertThat(o0).isNotEqualTo(mock(Object.class)); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof PersistentEObject)) { return false; } PersistentEObject that = (PersistentEObject) o; return Objects.equals(id(), that.id()); }
DefaultPersistentEObject extends MinimalEStoreEObjectImpl implements PersistentEObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof PersistentEObject)) { return false; } PersistentEObject that = (PersistentEObject) o; return Objects.equals(id(), that.id()); } }
DefaultPersistentEObject extends MinimalEStoreEObjectImpl implements PersistentEObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof PersistentEObject)) { return false; } PersistentEObject that = (PersistentEObject) o; return Objects.equals(id(), that.id()); } @VisibleForTesting  DefaultPersistentEObject(); protected  DefaultPersistentEObject(Id id); }
DefaultPersistentEObject extends MinimalEStoreEObjectImpl implements PersistentEObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof PersistentEObject)) { return false; } PersistentEObject that = (PersistentEObject) o; return Objects.equals(id(), that.id()); } @VisibleForTesting  DefaultPersistentEObject(); protected  DefaultPersistentEObject(Id id); @Nonnull @Override Id id(); @Override void id(Id newId); @Override @Nullable Resource.Internal resource(); @Override void resource(@Nullable Resource.Internal newResource); @Override void eSetDirectResource(@Nullable Resource.Internal resource); @Nonnull @Override EList<EObject> eContents(); @Nonnull @Override @SuppressWarnings("unchecked") TreeIterator<EObject> eAllContents(); @Nullable @Override Resource.Internal eInternalResource(); @Override void eSetStore(EStore store); @Override String toString(); @Nonnull @Override StoreAdapter eStore(); @Nullable @Override Object dynamicGet(int dynamicFeatureId); @Override void dynamicSet(int dynamicFeatureId, Object value); @Override void dynamicUnset(int dynamicFeatureId); @Override PersistentEObject eInternalContainer(); @Override int eContainerFeatureID(); @Override int hashCode(); @Override boolean equals(@Nullable Object o); }
DefaultPersistentEObject extends MinimalEStoreEObjectImpl implements PersistentEObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof PersistentEObject)) { return false; } PersistentEObject that = (PersistentEObject) o; return Objects.equals(id(), that.id()); } @VisibleForTesting  DefaultPersistentEObject(); protected  DefaultPersistentEObject(Id id); @Nonnull @Override Id id(); @Override void id(Id newId); @Override @Nullable Resource.Internal resource(); @Override void resource(@Nullable Resource.Internal newResource); @Override void eSetDirectResource(@Nullable Resource.Internal resource); @Nonnull @Override EList<EObject> eContents(); @Nonnull @Override @SuppressWarnings("unchecked") TreeIterator<EObject> eAllContents(); @Nullable @Override Resource.Internal eInternalResource(); @Override void eSetStore(EStore store); @Override String toString(); @Nonnull @Override StoreAdapter eStore(); @Nullable @Override Object dynamicGet(int dynamicFeatureId); @Override void dynamicSet(int dynamicFeatureId, Object value); @Override void dynamicUnset(int dynamicFeatureId); @Override PersistentEObject eInternalContainer(); @Override int eContainerFeatureID(); @Override int hashCode(); @Override boolean equals(@Nullable Object o);  }