Source:
<code>void registerMetricSet() { Meter existingInnerMeter = StormMetricsRegistry.registerMeter(name(INNER_SET, INNER_METER)); <START> System.out.println("register outer set"); <END> StormMetricsRegistry.registerMetricSet(OUTER); assertSame(OUTER.getMetrics().get(OUTER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_TIMER)); assertSame(OUTER.getMetrics().get(OUTER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_METER)); assertSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_TIMER))); assertNotSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); assertSame(existingInnerMeter, StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); System.out.println("twice register outer set"); MetricSet newOuter = newMetricSetInstance(); StormMetricsRegistry.registerMetricSet(newOuter); assertSame(OUTER.getMetrics().get(OUTER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_TIMER)); assertSame(OUTER.getMetrics().get(OUTER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_METER)); assertSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_TIMER))); assertSame(existingInnerMeter, StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); System.out.println("name collision"); assertThrows(IllegalArgumentException.class, () -> StormMetricsRegistry.registerGauge(name(INNER_SET, INNER_METER), () -> 0)); }</code><technical_language>Please a Logger instead, I System.out ends in console, other logs files run tests</technical_language>

Target:
void registerMetricSet() { Meter existingInnerMeter = StormMetricsRegistry.registerMeter(name(INNER_SET, INNER_METER)); LOG.info("register outer set"); StormMetricsRegistry.registerMetricSet(OUTER); assertSame(OUTER.getMetrics().get(OUTER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_TIMER)); assertSame(OUTER.getMetrics().get(OUTER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_METER)); assertSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_TIMER))); assertNotSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); assertSame(existingInnerMeter, StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); LOG.info("twice register outer set"); MetricSet newOuter = newMetricSetInstance(); StormMetricsRegistry.registerMetricSet(newOuter); assertSame(OUTER.getMetrics().get(OUTER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_TIMER)); assertSame(OUTER.getMetrics().get(OUTER_METER), StormMetricsRegistry.REGISTRY.getMetrics().get(OUTER_METER)); assertSame(((MetricSet) OUTER.getMetrics().get(INNER_SET)).getMetrics().get(INNER_TIMER), StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_TIMER))); assertSame(existingInnerMeter, StormMetricsRegistry.REGISTRY.getMetrics().get(name(INNER_SET, INNER_METER))); LOG.info("name collision"); assertThrows(IllegalArgumentException.class, () -> StormMetricsRegistry.registerGauge(name(INNER_SET, INNER_METER), () -> 0)); }