LookoutRegistry extends ResettableStepRegistry implements CommonTagsAccessor { public void addMetricObserver(MetricObserver metricObserver) { if (metricObserver == null) { return; } metricObserverComposite.addMetricObserver(metricObserver); } LookoutRegistry(Clock clock, MetricObserver<LookoutMeasurement> observer,
                           LookoutConfig config);  LookoutRegistry(Clock clock, MetricObserver<LookoutMeasurement> observer,
                           LookoutConfig config, AddressService addressService);  LookoutRegistry(Clock clock, MetricObserver<LookoutMeasurement> observer,
                           LookoutConfig config, AddressService addressService, long currentStep);  LookoutRegistry(LookoutConfig config);  LookoutRegistry(LookoutConfig config, AddressService addressService);  LookoutRegistry(MetricObserver<LookoutMeasurement> observer); static AddressService getAddressService(LookoutConfig config); void destroy(); void addMetricObserver(MetricObserver metricObserver); Collection<MetricObserver> getMetricObservers(); void addMetricObserverMeasurementsFilter(MetricObserverMeasurementsFilter metricObserverMeasurementsFilter); MetricObserverComposite getMetricObserverComposite();  }
@Test public void testAddMetricObservers() throws InterruptedException { registry.addMetricObserver(new MetricObserver() { @Override public void update(List measures, Map metadata) { System.out.println("===>2"); } @Override public boolean isEnable() { return true; } }); try { Field field = registry.getClass().getDeclaredField("metricObserverComposite"); field.setAccessible(true); MetricObserverComposite metricObserverComposite = (MetricObserverComposite) field .get(registry); Assert.assertTrue(metricObserverComposite.size() > 1); } catch (Throwable e) { throw new RuntimeException("xx", e); } }