private void initDropwizardMetricsRegistry() {
        // This normally gets done by dropwizard on boot
        try {
            SharedMetricRegistries.getDefault();
            LOGGER.info("Using existing static metrics registry");
        } catch (IllegalStateException e) {
            LOGGER.info("Creating new static metrics registry for testing");
            SharedMetricRegistries.setDefault("defaultRegistry", new MetricRegistry());
        }
    }
This test listener is registered by service loader using the file
stroom-test-common/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener
Its methods will be called for any tests that include stroom-test-common as a dependency.
stroom-test-common/src/main/java/stroom/test/common/util/test/StroomTestExecutionListener.java