public void collect(@Nonnull Metric metric, @Nonnull Object value) {
        String parameter = metric.getQueryParameter();
        String valueStr = value.toString();

        if (parameters.containsKey(parameter)) {
            throw new IllegalArgumentException("Parameter " + parameter + " is already added");
        }

        parameters.put(parameter, valueStr);
        query = null;
    }
@Test
    public void checkDuplicateKey() {
        MetricsCollectionContext context = new MetricsCollectionContext();
        context.collect(() -> "1", "hazelcast");

        assertThatThrownBy(() -> context.collect(() -> "1", "phonehome"))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("Parameter 1 is already added");
    }