SharedHealthCheckRegistries { public synchronized static HealthCheckRegistry setDefault(String name) { final HealthCheckRegistry registry = getOrCreate(name); return setDefault(name, registry); } private  SharedHealthCheckRegistries(); static void clear(); static Set<String> names(); static void remove(String key); static HealthCheckRegistry add(String name, HealthCheckRegistry registry); static HealthCheckRegistry getOrCreate(String name); synchronized static HealthCheckRegistry setDefault(String name); static HealthCheckRegistry setDefault(String name, HealthCheckRegistry healthCheckRegistry); static HealthCheckRegistry getDefault(); static HealthCheckRegistry tryGetDefault();  }
@Test public void unableToSetDefaultRegistryTwice() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Default health check registry is already set."); SharedHealthCheckRegistries.setDefault("default"); SharedHealthCheckRegistries.setDefault("default"); }
@Test public void unableToSetCustomDefaultRegistryTwice() { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Default health check registry is already set."); SharedHealthCheckRegistries.setDefault("default", new HealthCheckRegistry()); SharedHealthCheckRegistries.setDefault("default", new HealthCheckRegistry()); }