GraphVersion { public int deepHashCode() { int hash = 3; hash = 17 * hash + this.nodeVersion; hash = 17 * hash + this.edgeVersion; return hash; } GraphVersion(Graph graph); int incrementAndGetNodeVersion(); int incrementAndGetEdgeVersion(); int deepHashCode(); boolean deepEquals(GraphVersion obj);  }
@Test public void testHashCode() { GraphVersion g1 = new GraphVersion(null); g1.nodeVersion = 5; g1.edgeVersion = 10; GraphVersion g2 = new GraphVersion(null); g2.nodeVersion = 5; g2.edgeVersion = 10; GraphVersion g3 = new GraphVersion(null); g3.nodeVersion = 5; g3.edgeVersion = 0; GraphVersion g4 = new GraphVersion(null); g4.nodeVersion = 0; g4.edgeVersion = 10; Assert.assertEquals(g1.deepHashCode(), g2.deepHashCode()); Assert.assertNotEquals(g1.deepHashCode(), g3.deepHashCode()); Assert.assertNotEquals(g1.deepHashCode(), g4.deepHashCode()); }