CompositeCounter implements Counter { @Override public void inc() { for (Counter counter : counters) { counter.inc(); } } CompositeCounter(Collection<? extends Counter> counters); @Override void inc(); @Override void inc(long increment);  }
@Test public void incrementActionsIncrementAllSubcounters() { SimpleCounter first = new SimpleCounter(); SimpleCounter second = new SimpleCounter(); CompositeCounter counter = new CompositeCounter(Arrays.asList(first, second)); counter.inc(); Assert.assertEquals(1, first.value); Assert.assertEquals(1, second.value); counter.inc(10); Assert.assertEquals(11, first.value); Assert.assertEquals(11, second.value); }