MemTriple implements Triple, MemResource { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other instanceof Triple) { Triple that = (Triple) other; return this.subject.equals(that.getSubject()) && this.predicate.equals(that.getPredicate()) && this.object.equals(that.getObject()); } return false; } MemTriple(Object creator, MemResource subject, MemIRI predicate, MemValue object); @Override String stringValue(); @Override String toString(); @Override Object getCreator(); @Override boolean hasStatements(); @Override MemStatementList getObjectStatementList(); @Override int getObjectStatementCount(); @Override void addObjectStatement(MemStatement st); @Override void removeObjectStatement(MemStatement st); @Override void cleanSnapshotsFromObjectStatements(int currentSnapshot); @Override MemStatementList getSubjectStatementList(); @Override int getSubjectStatementCount(); @Override void addSubjectStatement(MemStatement st); @Override void removeSubjectStatement(MemStatement st); @Override void cleanSnapshotsFromSubjectStatements(int currentSnapshot); @Override MemStatementList getContextStatementList(); @Override int getContextStatementCount(); @Override void addContextStatement(MemStatement st); @Override void removeContextStatement(MemStatement st); @Override void cleanSnapshotsFromContextStatements(int currentSnapshot); @Override Resource getSubject(); @Override IRI getPredicate(); @Override Value getObject(); @Override int hashCode(); @Override boolean equals(Object other);  }
@Test public void testEquals() { SimpleTriple equalTriple = (SimpleTriple) SimpleValueFactory.getInstance().createTriple(s1, p1, o1); assertThat(triple).isEqualTo(equalTriple); SimpleTriple unequalTriple = (SimpleTriple) SimpleValueFactory.getInstance().createTriple(s1, o1, p1); assertThat(triple).isNotEqualTo(unequalTriple); }