@@ -0,0 +1,1334 @@
+package com.emc.mongoose.metrics.util;%0A%0Aimport io.prometheus.client.Collector;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.util.List;%0A%0A/**%0A @author veronika K. on 09.10.18 */%0Apublic class MetricsCollectorTest %7B%0A%0A%09private final MetricsCollector metricsCollector = new MetricsCollector();%0A%09private final int METRICS_COUNT = 7;    //sum, min, max, count, mean, loQ, hiQ%0A%09private final long ITERATION_COUNT = 10_000_000;%0A%0A%09@Test%0A%09public void test() %7B%0A%09%09long sum = 0;%0A%09%09for(long i = 0; i %3C ITERATION_COUNT; ++ i) %7B%0A%09%09%09metricsCollector.update(i);%0A%09%09%09sum += i;%0A%09%09%7D%0A%09%09final List%3CCollector.MetricFamilySamples.Sample%3E samples = metricsCollector.collect().get(0).samples;%0A%09%09//%0A%09%09Assert.assertEquals(metricsCollector.collect().size(), 1);%0A%09%09Assert.assertEquals(samples.size(), METRICS_COUNT);%0A%09%09//count%0A%09%09Assert.assertEquals(new Double(samples.get(0).value).longValue(), ITERATION_COUNT);%0A%09%09//sum%0A%09%09Assert.assertEquals(new Double(samples.get(1).value).longValue(), sum);%0A%09%09//max%0A%09%09Assert.assertEquals(new Double(samples.get(2).value).longValue(), ITERATION_COUNT - 1);%0A%09%09//min%0A%09%09Assert.assertEquals(new Double(samples.get(3).value).longValue(), 0);%0A%09%09//mean%0A%09%09final double mean = ((double) sum) / ITERATION_COUNT;%0A%09%09Assert.assertEquals(new Double(samples.get(4).value).longValue(), mean, mean * 0.05);%0A%09%09//TODO: quantieles%0A%09%7D%0A%7D%0A

save (added MetricsCollector) [skip ci]