public <UpdateT> List<UpdateT> extractUpdates(
      boolean delta, CounterUpdateExtractor<UpdateT> extractors) {
    return extractUpdatesImpl(delta, false, extractors);
  }
@Test
  public void testExtractUpdates() {
    CounterSet deltaSet = new CounterSet();
    CounterSet cumulativeSet = new CounterSet();

    CounterUpdateExtractor<?> updateExtractor = Mockito.mock(CounterUpdateExtractor.class);

    Counter<Long, Long> delta1 = deltaSet.longSum(name1);
    Counter<Long, Long> cumulative1 = cumulativeSet.longSum(name1);

    // delta counters

    delta1.addValue(10L);

    deltaSet.extractUpdates(true, updateExtractor);
    verify(updateExtractor).longSum(name1, true, 10L);

    delta1.addValue(5L);

    deltaSet.extractUpdates(true, updateExtractor);
    verify(updateExtractor).longSum(name1, true, 5L);

    // no updates to delta counters

    deltaSet.extractUpdates(true, updateExtractor);
    verify(updateExtractor).longSum(name1, true, 0L);

    // cumulative counters

    cumulative1.addValue(10L);

    cumulativeSet.extractUpdates(false, updateExtractor);
    verify(updateExtractor).longSum(name1, false, 10L);

    cumulative1.addValue(5L);

    cumulativeSet.extractUpdates(false, updateExtractor);
    verify(updateExtractor).longSum(name1, false, 15L);

    // no updates to cumulative counters

    cumulativeSet.extractUpdates(false, updateExtractor);
    verify(updateExtractor, times(2)).longSum(name1, false, 15L);

    // test extracting only modified deltas

    Counter<Integer, Integer> delta2 = deltaSet.intSum(name2);

    delta1.addValue(100L);
    delta2.addValue(200);

    deltaSet.extractModifiedDeltaUpdates(updateExtractor);
    verify(updateExtractor).longSum(name1, true, 100L);
    verify(updateExtractor).intSum(name2, true, 200);

    delta1.addValue(1L);
    deltaSet.extractModifiedDeltaUpdates(updateExtractor);
    verify(updateExtractor).longSum(name1, true, 1L);

    delta2.addValue(5);
    deltaSet.extractModifiedDeltaUpdates(updateExtractor);
    verify(updateExtractor).intSum(name2, true, 5);

    verifyNoMoreInteractions(updateExtractor);
  }