Bucket { public Set<Map.Entry<Identifier, UntypedMetric>> entrySet() { return values.entrySet(); } Bucket();  Bucket(long fromMillis, long toMillis); Set<Map.Entry<Identifier, UntypedMetric>> entrySet(); Collection<String> getAllMetricNames(); Collection<Map.Entry<Point, UntypedMetric>> getValuesForMetric(String metricName); Map<Point, UntypedMetric> getMapForMetric(String metricName); Map<String, List<Map.Entry<Point, UntypedMetric>>> getValuesByMetricName(); @Override String toString(); long getFromMillis(); long getToMillis();  }
@Test public final void testEntrySet() { assertEquals(0, bucket.entrySet().size()); for (int i = 0; i < 4; ++i) { bucket.put(new Sample(new Measurement(i), new Identifier("nalle_" + i, null), AssumedType.GAUGE)); } assertEquals(4, bucket.entrySet().size()); for (int i = 0; i < 4; ++i) { bucket.put(new Sample(new Measurement(i), new Identifier("nalle", new Point(new ImmutableMap.Builder<String, Integer>().put("dim", Integer.valueOf(i)).build())), AssumedType.GAUGE)); } assertEquals(8, bucket.entrySet().size()); int nalle = 0, nalle0 = 0, nalle1 = 0, nalle2 = 0, nalle3 = 0; for (Entry<Identifier, UntypedMetric> x : bucket.entrySet()) { String metricName = x.getKey().getName(); switch (metricName) { case "nalle": ++nalle; break; case "nalle_0": ++nalle0; break; case "nalle_1": ++nalle1; break; case "nalle_2": ++nalle2; break; case "nalle_3": ++nalle3; break; default: throw new IllegalStateException(); } } assertEquals(4, nalle); assertEquals(1, nalle0); assertEquals(1, nalle1); assertEquals(1, nalle2); assertEquals(1, nalle3); }