Node extends AbstractGraphElement { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Node other = (Node) o; return getName().equals(other.getName()); } Node(String name); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testNodeEquals() { Node n1 = new Node("n1"); n1.setProperty("x1", true); Node n2 = new Node("n1"); n2.setProperty("x1", false); assertThat(n1 == n2, is(false)); assertThat(n1.equals(n2), is(true)); assertThat(n1.equals(null), is(false)); assertThat(n1.equals("some-other-data-type"), is(false)); }