### Question:
DiagramImpl extends AbstractDiagram<Graph, Metadata> { @Override public int hashCode() { int graphHash = (null != getGraph()) ? getGraph().hashCode() : 0; int metadataHash = (null != getMetadata()) ? getMetadata().hashCode() : 0; int nameHash = (null != getName()) ? getName().hashCode() : 0; return HashUtil.combineHashCodes(graphHash, metadataHash, nameHash); } DiagramImpl(final @MapsTo("name") String name,
                       final @MapsTo("metadata") Metadata metadata);  DiagramImpl(final String name,
                       final Graph graph,
                       final Metadata metadata); @Override int hashCode(); @Override boolean equals(Object o);  }### Answer:
@Test public void testDiagramHashCode() { DiagramImpl a = new DiagramImpl("Diagram", new MetadataImpl()); DiagramImpl b = new DiagramImpl("AnotherDiagram", new MetadataImpl()); assertNotEquals(a.hashCode(), b.hashCode()); b = new DiagramImpl("Diagram", new MetadataImpl()); assertEquals(a.hashCode(), b.hashCode()); a.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl())); b.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl())); assertEquals(a.hashCode(), b.hashCode()); a.getGraph().addNode(new NodeImpl("Node1")); b.getGraph().addNode(new NodeImpl("Node2")); assertNotEquals(a.hashCode(), b.hashCode()); b.getGraph().removeNode("Node2"); b.getGraph().addNode(new NodeImpl("Node1")); assertEquals(a.hashCode(), b.hashCode()); assertEquals(a.hashCode(), a.hashCode()); }