@Override
    public int compareTo(SegmentPointer other) {
        if (idPage == other.idPage) {
            return Long.compare(offset, other.offset);
        } else {
            return Integer.compare(idPage, other.idPage);
        }
    }
@Test
    public void testCompareInSameSegment() {
        final SegmentPointer minor = new SegmentPointer(1, 10);
        final SegmentPointer otherMinor = new SegmentPointer(1, 10);
        final SegmentPointer major = new SegmentPointer(1, 12);

        assertEquals(-1, minor.compareTo(major), "minor is less than major");
        assertEquals(1, major.compareTo(minor), "major is greater than minor");
        assertEquals(0, minor.compareTo(otherMinor), "minor equals itself");
    }