Graph implements GraphInterface { @Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (obj.getClass() != this.getClass()) return false; Graph b = (Graph) obj; return nodeSet.equals(b.getAllNodes()) && getAllEdges().equals(b.getAllEdges()) ; } Graph(); static Graph fromDotty(File dottyFile); void addNode(NodeInterface n); Set<NodeInterface> getAllNodes(); Set<EdgeInterface> getAllEdges(); @Override String toString(); @Override String toDot(); String toXML(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public final void testEquals() { Graph testGraphCopy = copyGraph(); assertEquals(testGraph, testGraphCopy); }
@Test public final void testNotEqualEdgeSet() { Graph testGraphCopy = copyGraph(); F.outEdges.remove(FG); G.outEdges.remove(FG); assertFalse(testGraph.equals(testGraphCopy)); }
@Test public final void testNotEqualEdgeAttributes() { Graph testGraphCopy = copyGraph(); AB.setAttribute("label", "BA"); assertFalse(testGraph.equals(testGraphCopy)); }
@Test public final void testNotEqualNodeAttributes() { Graph testGraphCopy = copyGraph(); A.setAttribute("label", "Node C"); assertFalse(testGraph.equals(testGraphCopy)); }