### Question:
CompositeRegistry implements Registry { @Override public DistributionSummary distributionSummary(Id id) { return new SwapDistributionSummary(this, version::get, id, newDistributionSummary(id)); } CompositeRegistry(Clock clock); void add(Registry registry); void remove(Registry registry); void removeAll(); @Override Clock clock(); @Override Id createId(String name); @Override Id createId(String name, Iterable<Tag> tags); @Override void register(Meter meter); @Override ConcurrentMap<Id, Object> state(); @Override Counter counter(Id id); @Override DistributionSummary distributionSummary(Id id); @Override Timer timer(Id id); @Override Gauge gauge(Id id); @Override Gauge maxGauge(Id id); @Override Meter get(Id id); @Override Iterator<Meter> iterator();  }### Answer:
@Test public void testDistributionSummary() { Registry r = newRegistry(5, true); DistributionSummary t = r.distributionSummary(r.createId("foo")); t.record(42L); Assertions.assertEquals(t.count(), 1L); DistributionSummary t2 = r.distributionSummary(r.createId("foo")); Assertions.assertEquals(t.totalAmount(), t2.totalAmount()); }
@Test public void correctTypeForDistSummariesStream() { Registry r = newRegistry(5, false); r.distributionSummary("a").record(1); r.distributionSummary("b").record(1); Assertions.assertEquals(2, r.distributionSummaries().count()); Assertions.assertEquals(2, r.stream().filter(m -> m instanceof DistributionSummary).count()); }