public void importCounters(String[] counterNames, String[] counterKinds, long[] counterDeltas) {
    final int length = counterNames.length;
    if (counterKinds.length != length || counterDeltas.length != length) {
      throw new AssertionError("array lengths do not match");
    }
    for (int i = 0; i < length; ++i) {
      final CounterName name = CounterName.named(counterPrefix + counterNames[i]);
      final String kind = counterKinds[i];
      final long delta = counterDeltas[i];
      switch (kind) {
        case "sum":
          counterFactory.longSum(name).addValue(delta);
          break;
        case "max":
          counterFactory.longMax(name).addValue(delta);
          break;
        case "min":
          counterFactory.longMin(name).addValue(delta);
          break;
        default:
          throw new IllegalArgumentException("unsupported counter kind: " + kind);
      }
    }
  }
@Test
  public void testSinglePreexistingCounter() throws Exception {
    Counter<Long, Long> sumCounter =
        counterSet.longSum(CounterName.named("stageName-systemName-dataset-sum_counter"));
    sumCounter.addValue(1000L);
    String[] names = {"sum_counter"};
    String[] kinds = {"sum"};
    long[] deltas = {122};
    counters.importCounters(names, kinds, deltas);

    counterSet.extractUpdates(false, mockUpdateExtractor);
    verify(mockUpdateExtractor)
        .longSum(named("stageName-systemName-dataset-sum_counter"), false, 1122L);
    verifyNoMoreInteractions(mockUpdateExtractor);
  }