boolean hasSpace(VirtualPointer mark, long length) {
        return bytesAfter(mark) >= length;
    }
@Test
    public void testHasSpace() throws IOException {
        final MappedByteBuffer pageBuffer = Utils.createPageFile();

        final Segment segment = new Segment(pageBuffer, new SegmentPointer(0, 0), new SegmentPointer(0, 1023));

        final VirtualPointer current = new VirtualPointer(511);
        final VirtualPointer otherCurrent = current.moveForward(pageBuffer.capacity()); // pointer in next page

        assertTrue(segment.hasSpace(current, 512));
        assertFalse(segment.hasSpace(current, 513));
        assertFalse(segment.hasSpace(otherCurrent, 513));
    }