@Test public void adding_the_same_child_set_twice_has_no_effect() { MetricSet child = new MetricSet("child", ImmutableList.of(new Metric("child_metric"))); MetricSet parent = new MetricSet("parent", emptyList(), ImmutableList.of(child, child)); Map<String, Metric> parentMetrics = parent.getMetrics(); assertEquals(1, parentMetrics.size()); assertNotNull(parentMetrics.get("child_metric")); }
public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); static MetricSet empty(); final String getId(); final Map<String, Metric> getMetrics(); @Override boolean equals(Object o); @Override int hashCode(); }
MetricSet { public final Map<String, Metric> getMetrics() { return unmodifiableMap(flatten(metrics, children)); } MetricSet(String id, Collection<Metric> metrics);  MetricSet(String id, Collection<Metric> metrics, Collection<MetricSet> children); static MetricSet empty(); final String getId(); final Map<String, Metric> getMetrics(); @Override boolean equals(Object o); @Override int hashCode();  }