SharedHealthCheckRegistries { public static HealthCheckRegistry getOrCreate(String name) { final HealthCheckRegistry existing = REGISTRIES.get(name); if (existing == null) { final HealthCheckRegistry created = new HealthCheckRegistry(); final HealthCheckRegistry raced = add(name, created); if (raced == null) { return created; } return raced; } return existing; } 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 savesCreatedRegistry() { final HealthCheckRegistry one = SharedHealthCheckRegistries.getOrCreate("db"); final HealthCheckRegistry two = SharedHealthCheckRegistries.getOrCreate("db"); assertThat(one).isSameAs(two); }