@SafeVarargs
    public static <S extends Comparable<S>> QueryLimit<S> getMinimum(QueryLimit<S> limit, QueryLimit<S>... limits)
    {
        Optional<QueryLimit<S>> queryLimit = Stream.concat(
                limits != null ? Arrays.stream(limits) : Stream.empty(),
                limit != null ? Stream.of(limit) : Stream.empty())
                .filter(Objects::nonNull)
                .min(Comparator.comparing(QueryLimit::getLimit));
        return queryLimit.orElseThrow(() -> new IllegalArgumentException("At least one nonnull argument is required."));
    }
@Test
    public void testGetMinimum()
    {
        QueryLimit<Duration> longLimit = createDurationLimit(new Duration(2, HOURS), SYSTEM);
        QueryLimit<Duration> shortLimit = createDurationLimit(new Duration(1, MINUTES), RESOURCE_GROUP);
        assertEquals(getMinimum(QUERY_LIMIT_DURATION, longLimit, shortLimit), shortLimit);

        QueryLimit<DataSize> largeLimit = createDataSizeLimit(new DataSize(2, MEGABYTE), QUERY);
        QueryLimit<DataSize> smallLimit = createDataSizeLimit(new DataSize(1, BYTE), RESOURCE_GROUP);
        assertEquals(getMinimum(smallLimit, QUERY_LIMIT_DATA_SIZE, largeLimit), smallLimit);
        assertEquals(getMinimum(null, QUERY_LIMIT_DATA_SIZE, largeLimit), QUERY_LIMIT_DATA_SIZE);
        assertEquals(getMinimum(null, largeLimit, null, null, QUERY_LIMIT_DATA_SIZE), QUERY_LIMIT_DATA_SIZE);
        assertEquals(getMinimum(smallLimit, null, null, null), smallLimit);
        assertThrows(IllegalArgumentException.class, () -> getMinimum(null));
        assertThrows(IllegalArgumentException.class, () -> getMinimum(null, null, null));
    }