public static RocksDbIndexedTimeOrderedWindowBytesStoreSupplier create(final String name,
                                                                           final Duration retentionPeriod,
                                                                           final Duration windowSize,
                                                                           final boolean retainDuplicates,
                                                                           final boolean hasIndex) {
        Objects.requireNonNull(name, "name cannot be null");
        final String rpMsgPrefix = prepareMillisCheckFailMsgPrefix(retentionPeriod, "retentionPeriod");
        final long retentionMs = validateMillisecondDuration(retentionPeriod, rpMsgPrefix);
        final String wsMsgPrefix = prepareMillisCheckFailMsgPrefix(windowSize, "windowSize");
        final long windowSizeMs = validateMillisecondDuration(windowSize, wsMsgPrefix);

        final long defaultSegmentInterval = Math.max(retentionMs / 2, 60_000L);

        if (retentionMs < 0L) {
            throw new IllegalArgumentException("retentionPeriod cannot be negative");
        }
        if (windowSizeMs < 0L) {
            throw new IllegalArgumentException("windowSize cannot be negative");
        }
        if (defaultSegmentInterval < 1L) {
            throw new IllegalArgumentException("segmentInterval cannot be zero or negative");
        }
        if (windowSizeMs > retentionMs) {
            throw new IllegalArgumentException("The retention period of the window store "
                + name + " must be no smaller than its window size. Got size=["
                + windowSizeMs + "], retention=[" + retentionMs + "]");
        }

        return new RocksDbIndexedTimeOrderedWindowBytesStoreSupplier(name, retentionMs,
            defaultSegmentInterval, windowSizeMs, retainDuplicates, hasIndex);
    }
@Test
    public void shouldThrowIfWindowSizeIsNegative() {
        final Exception e = assertThrows(IllegalArgumentException.class, () -> RocksDbIndexedTimeOrderedWindowBytesStoreSupplier.create("anyName", ofMillis(0L), ofMillis(-1L), false, false));
        assertEquals("windowSize cannot be negative", e.getMessage());
    }