public static MetricRegistry getDefault() {
        MetricRegistry metricRegistry = tryGetDefault();
        if (metricRegistry == null) {
            throw new IllegalStateException("Default registry name has not been set.");
        }
        return metricRegistry;
    }
@Test
    public void errorsWhenDefaultUnset() {
        exception.expect(IllegalStateException.class);
        exception.expectMessage("Default registry name has not been set.");
        SharedMetricRegistries.getDefault();
    }