### Question:
ClusterParamMetric { public ClusterParamMetric(int sampleCount, int intervalInMs) { this(sampleCount, intervalInMs, DEFAULT_CLUSTER_MAX_CAPACITY); } ClusterParamMetric(int sampleCount, int intervalInMs);  ClusterParamMetric(int sampleCount, int intervalInMs, int maxCapacity); long getSum(Object value); void addValue(Object value, int count); double getAvg(Object value); Map<Object, Double> getTopValues(int number); static final int DEFAULT_CLUSTER_MAX_CAPACITY; }### Answer:
@Test public void testClusterParamMetric() { setCurrentMillis(System.currentTimeMillis()); Map<Object, Double> topMap = new HashMap<Object, Double>(); ClusterParamMetric metric = new ClusterParamMetric(5, 25, 100); metric.addValue("e1", -1); metric.addValue("e1", -2); metric.addValue("e2", 100); metric.addValue("e2", 23); metric.addValue("e3", 100); metric.addValue("e3", 230); Assert.assertEquals(-3, metric.getSum("e1")); Assert.assertEquals(-120, metric.getAvg("e1"), 0.01); topMap.put("e3", (double) 13200); Assert.assertEquals(topMap, metric.getTopValues(1)); topMap.put("e2", (double) 4920); topMap.put("e1", (double) -120); Assert.assertEquals(topMap, metric.getTopValues(5)); metric.addValue("e2", 100); metric.addValue("e2", 23); Assert.assertEquals(246, metric.getSum("e2")); Assert.assertEquals(9840, metric.getAvg("e2"), 0.01); }