@Override public int hashCode() { return key.hashCode(); } }
@Test public void testSAMReaderIDHashingAndEquality() { // Test to make sure that two SAMReaderIDs that point at the same file via an absolute vs. relative // path are equal according to equals() and have the same hash code final File relativePathToBAMFile = new File(publicTestDir + "exampleBAM.bam"); final File absolutePathToBAMFile = new File(relativePathToBAMFile.getAbsolutePath()); final SAMReaderID relativePathSAMReaderID = new SAMReaderID(relativePathToBAMFile, new Tags()); final SAMReaderID absolutePathSAMReaderID = new SAMReaderID(absolutePathToBAMFile, new Tags()); Assert.assertEquals(relativePathSAMReaderID, absolutePathSAMReaderID, "Absolute-path and relative-path SAMReaderIDs not equal according to equals()"); Assert.assertEquals(relativePathSAMReaderID.hashCode(), absolutePathSAMReaderID.hashCode(), "Absolute-path and relative-path SAMReaderIDs have different hash codes"); } }