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 shouldNotCreateReservedSegmentWithNonNegativeId() {
        assertThrows(IllegalArgumentException.class, () -> segments.createReservedSegment(0, "reserved"));
        assertThrows(IllegalArgumentException.class, () -> segments.createReservedSegment(1, "reserved"));
    }