### Question:
PolledMeter { public static IdBuilder<Builder> using(Registry registry) { return new IdBuilder<Builder>(registry) { @Override protected Builder createTypeBuilder(Id id) { return new Builder(registry, id); } }; } private  PolledMeter(); static IdBuilder<Builder> using(Registry registry); static void update(Registry registry); static void remove(Registry registry, Id id); @Deprecated static void monitorMeter(Registry registry, Meter meter);  }### Answer:
@Test public void monitorValueNullPropagate() { RegistryConfig config = s -> s.equals("propagateWarnings") ? "true" : null; Registry r = new DefaultRegistry(Clock.SYSTEM, config); Id id = r.createId("test"); IllegalArgumentException e = Assertions.assertThrows( IllegalArgumentException.class, () -> PolledMeter.using(r) .withId(id) .<Collection<?>>monitorValue(null, Collection::size) ); Assertions.assertTrue(e.getMessage().startsWith("obj is null")); }
@Test public void monitorMonotonicCounterNullPropagate() { RegistryConfig config = s -> s.equals("propagateWarnings") ? "true" : null; Registry r = new DefaultRegistry(Clock.SYSTEM, config); Id id = r.createId("test"); AtomicLong v = new AtomicLong(42); IllegalArgumentException e = Assertions.assertThrows( IllegalArgumentException.class, () -> PolledMeter.using(r) .withId(id) .<AtomicLong>monitorValue(null, n -> v.get()) ); Assertions.assertTrue(e.getMessage().startsWith("obj is null")); }