LogicalKeyValueSegment createReservedSegment(final long segmentId,
                                                 final String segmentName) {
        if (segmentId >= 0) {
            throw new IllegalArgumentException("segmentId for a reserved segment must be negative");
        }

        final LogicalKeyValueSegment newSegment = new LogicalKeyValueSegment(segmentId, segmentName, physicalStore);

        if (reservedSegments.put(segmentId, newSegment) != null) {
            throw new IllegalStateException("LogicalKeyValueSegment already exists.");
        }

        return newSegment;
    }
@Test
    public void shouldCreateReservedSegments() {
        final LogicalKeyValueSegment reservedSegment1 = segments.createReservedSegment(-1, "reserved-1");
        final LogicalKeyValueSegment reservedSegment2 = segments.createReservedSegment(-2, "reserved-2");

        final File rocksdbDir = new File(new File(context.stateDir(), DB_FILE_DIR), STORE_NAME);
        assertTrue(rocksdbDir.isDirectory());

        assertTrue(reservedSegment1.isOpen());
        assertTrue(reservedSegment2.isOpen());
    }