Stagemonitor { private static void startMonitoring(MeasurementSession measurementSession) { if (!getPlugin(CorePlugin.class).isStagemonitorActive()) { logger.info("stagemonitor is deactivated"); disabled = true; } if (started || disabled) { return; } Stagemonitor.measurementSession = measurementSession; doStartMonitoring(); } private  Stagemonitor(); static synchronized void init(); static synchronized void shutDown(); @Deprecated static MetricRegistry getMetricRegistry(); static Metric2Registry getMetric2Registry(); static HealthCheckRegistry getHealthCheckRegistry(); static ConfigurationRegistry getConfiguration(); static T getPlugin(Class<T> plugin); @Deprecated static T getConfiguration(Class<T> plugin); static MeasurementSession getMeasurementSession(); static boolean isStarted(); static List<String> getPathsOfWidgetTabPlugins(); static List<String> getPathsOfWidgetMetricTabPlugins(); @Deprecated static void reset(); @Deprecated static void reset(MeasurementSession measurementSession);  }
@Test public void testStartMonitoring() throws Exception { when(corePlugin.isStagemonitorActive()).thenReturn(true); Stagemonitor.setConfiguration(configuration); Stagemonitor.reset(); final MeasurementSession measurementSession = new MeasurementSession("StagemonitorTest", "testHost", "testInstance"); Stagemonitor.reset(measurementSession); assertTrue(Stagemonitor.isStarted()); assertTrue(Stagemonitor.getMeasurementSession().isInitialized()); assertSame(measurementSession, Stagemonitor.getMeasurementSession()); assertThat(healthCheckRegistry.runHealthCheck("TestPlugin").isHealthy()).isTrue(); assertThat(healthCheckRegistry.runHealthCheck("TestExceptionPlugin").isHealthy()).isFalse(); }