### Question:
IMAMeasurementRecord extends ExaminableRecord { @Override public final int hashCode() { if (id == null) { return super.hashCode(); } return id.hashCode(); } IMAMeasurementRecord(final String path, final Digest hash); protected  IMAMeasurementRecord(); final Long getId(); final String getPath(); final Digest getHash(); final IMAReport getReport(); final void setReport(final IMAReport report); @Override final int hashCode(); @Override final boolean equals(final Object obj); @Override final String toString();  }### Answer:
@Test public final void testHashCodeEquals() throws ParseException { IMAMeasurementRecord r1 = getDefaultRecord(); IMAMeasurementRecord r2 = getDefaultRecord(); Assert.assertNotEquals(r1.hashCode(), r2.hashCode()); Assert.assertNotEquals(r2.hashCode(), r1.hashCode()); Assert.assertEquals(r1.hashCode(), r1.hashCode()); Assert.assertEquals(r2.hashCode(), r2.hashCode()); }
@Test public final void testHashCodeNotEqualsNames() throws ParseException { final String path = "/some/other/file"; IMAMeasurementRecord r1 = getDefaultRecord(); IMAMeasurementRecord r2 = new IMAMeasurementRecord(path, getDefaultDigest()); Assert.assertNotEquals(r1.hashCode(), r2.hashCode()); Assert.assertNotEquals(r2.hashCode(), r1.hashCode()); Assert.assertEquals(r1.hashCode(), r1.hashCode()); Assert.assertEquals(r2.hashCode(), r2.hashCode()); }
@Test public final void testHashCodeNotEqualsHashes() throws ParseException, DecoderException { final String hash = "aacc3c2f7f3003d2e4baddc46ed4763a4954f648"; final Digest digest = new Digest(DigestAlgorithm.SHA1, Hex.decodeHex(hash.toCharArray())); IMAMeasurementRecord r1 = getDefaultRecord(); IMAMeasurementRecord r2 = new IMAMeasurementRecord(DEFAULT_PATH, digest); Assert.assertNotEquals(r1.hashCode(), r2.hashCode()); Assert.assertNotEquals(r2.hashCode(), r1.hashCode()); Assert.assertEquals(r1.hashCode(), r1.hashCode()); Assert.assertEquals(r2.hashCode(), r2.hashCode()); }