ShapeFileIndexRecord implements Comparable<ShapeFileIndexRecord> { @Override @Pure public boolean equals(Object obj) { if (obj instanceof ShapeFileIndexRecord) { final ShapeFileIndexRecord r = (ShapeFileIndexRecord) obj; return r.offset == this.offset && r.length == this.length; } return false; } ShapeFileIndexRecord(int recordOffset, int length, boolean recordContentSize, int index); @Override @Pure int hashCode(); @Override @Pure boolean equals(Object obj); @Override @Pure int compareTo(ShapeFileIndexRecord record); @Override @Pure String toString(); @Pure int getOffsetInFile(); @Pure int getOffsetInContent(); @Pure int getEntireRecordLength(); @Pure int getRecordContentLength(); @Pure int getRecordIndex();  }
@Test public void testEqualsObject() { assertFalse(this.record.equals(null)); assertFalse(this.record.equals(new Object())); assertTrue(this.record.equals(this.record)); assertTrue(this.record.equals(new ShapeFileIndexRecord(this.offset, this.length, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset, this.length+2, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset, this.length-2, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset+2, this.length, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset+2, this.length+2, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset+2, this.length-2, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset-2, this.length, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset-2, this.length+2, false, -1))); assertFalse(this.record.equals(new ShapeFileIndexRecord(this.offset-2, this.length-2, false, -1))); }