SharedMetricRegistries { public synchronized static MetricRegistry setDefault(String name) { final MetricRegistry registry = getOrCreate(name); return setDefault(name, registry); } private  SharedMetricRegistries(); static void clear(); static Set<String> names(); static void remove(String key); static MetricRegistry add(String name, MetricRegistry registry); static MetricRegistry getOrCreate(String name); synchronized static MetricRegistry setDefault(String name); static MetricRegistry setDefault(String name, MetricRegistry metricRegistry); static MetricRegistry getDefault(); static MetricRegistry tryGetDefault();  }
@Test public void errorsWhenDefaultAlreadySet() { SharedMetricRegistries.setDefault("foobah"); exception.expect(IllegalStateException.class); exception.expectMessage("Default metric registry name is already set."); SharedMetricRegistries.setDefault("borg"); }