MetricsContainerStepMap implements Serializable { public void reset() { for (MetricsContainerImpl metricsContainer : metricsContainers.values()) { metricsContainer.reset(); } unboundContainer.reset(); } MetricsContainerStepMap(); MetricsContainerImpl getUnboundContainer(); MetricsContainerImpl getContainer(String stepName); void updateAll(MetricsContainerStepMap other); void update(String step, MetricsContainerImpl container); void reset(); @Override boolean equals(@Nullable Object object); @Override int hashCode(); static MetricResults asAttemptedOnlyMetricResults(
      MetricsContainerStepMap attemptedMetricsContainers); static MetricResults asMetricResults(
      MetricsContainerStepMap attemptedMetricsContainers,
      MetricsContainerStepMap committedMetricsContainers); Iterable<MonitoringInfo> getMonitoringInfos(); @Override String toString();  }
@Test public void testReset() { MetricsContainerStepMap attemptedMetrics = new MetricsContainerStepMap(); attemptedMetrics.update(STEP1, metricsContainer); attemptedMetrics.update(STEP2, metricsContainer); attemptedMetrics.update(STEP2, metricsContainer); MetricResults metricResults = asAttemptedOnlyMetricResults(attemptedMetrics); MetricQueryResults allres = metricResults.allMetrics(); assertCounter(COUNTER_NAME, allres, STEP1, VALUE, false); assertDistribution( DISTRIBUTION_NAME, allres, STEP1, DistributionResult.create(VALUE * 3, 2, VALUE, VALUE * 2), false); assertGauge(GAUGE_NAME, allres, STEP1, GaugeResult.create(VALUE, Instant.now()), false); assertCounter(COUNTER_NAME, allres, STEP2, VALUE * 2, false); assertDistribution( DISTRIBUTION_NAME, allres, STEP2, DistributionResult.create(VALUE * 6, 4, VALUE, VALUE * 2), false); assertGauge(GAUGE_NAME, allres, STEP2, GaugeResult.create(VALUE, Instant.now()), false); attemptedMetrics.reset(); metricResults = asAttemptedOnlyMetricResults(attemptedMetrics); allres = metricResults.allMetrics(); assertCounter(COUNTER_NAME, allres, STEP1, 0L, false); assertDistribution( DISTRIBUTION_NAME, allres, STEP1, DistributionResult.IDENTITY_ELEMENT, false); assertGauge(GAUGE_NAME, allres, STEP1, GaugeResult.empty(), false); assertCounter(COUNTER_NAME, allres, STEP2, 0L, false); assertDistribution( DISTRIBUTION_NAME, allres, STEP2, DistributionResult.IDENTITY_ELEMENT, false); assertGauge(GAUGE_NAME, allres, STEP2, GaugeResult.empty(), false); }