### Question:
Spectator { public static CompositeRegistry globalRegistry() { return COMPOSITE_REGISTRY; } private  Spectator(); @Deprecated static ExtendedRegistry registry(); static CompositeRegistry globalRegistry();  }### Answer:
@Test public void globalIterator() { Registry dflt = new DefaultRegistry(); CompositeRegistry global = Spectator.globalRegistry(); global.removeAll(); global.add(dflt); boolean found = false; Counter counter = dflt.counter("testCounter"); for (Meter m : global) { found |= m.id().equals(counter.id()); } Assertions.assertTrue(found, "id for sub-registry could not be found in global iterator"); }
@Test public void globalIteratorWithDifferences() { Registry r1 = new DefaultRegistry(); Registry r2 = new DefaultRegistry(); CompositeRegistry global = Spectator.globalRegistry(); global.removeAll(); global.add(r1); global.add(r2); boolean found = false; Counter counter = r2.counter("testCounter"); for (Meter m : global) { found |= m.id().equals(counter.id()); } Assertions.assertTrue(found, "id for sub-registry could not be found in global iterator"); }