MetricsContainerImpl implements Serializable, MetricsContainer { @Override public boolean equals(@Nullable Object object) { if (object instanceof MetricsContainerImpl) { MetricsContainerImpl metricsContainerImpl = (MetricsContainerImpl) object; return Objects.equals(stepName, metricsContainerImpl.stepName) && Objects.equals(counters, metricsContainerImpl.counters) && Objects.equals(distributions, metricsContainerImpl.distributions) && Objects.equals(gauges, metricsContainerImpl.gauges); } return false; } MetricsContainerImpl(@Nullable String stepName); void reset(); @Override CounterCell getCounter(MetricName metricName); @Nullable CounterCell tryGetCounter(MetricName metricName); @Override DistributionCell getDistribution(MetricName metricName); @Nullable DistributionCell tryGetDistribution(MetricName metricName); @Override GaugeCell getGauge(MetricName metricName); @Nullable GaugeCell tryGetGauge(MetricName metricName); MetricUpdates getUpdates(); Iterable<MonitoringInfo> getMonitoringInfos(); void commitUpdates(); MetricUpdates getCumulative(); void update(MetricsContainerImpl other); void update(Iterable<MonitoringInfo> monitoringInfos); @Override boolean equals(@Nullable Object object); @Override int hashCode();  }
@Test public void testEquals() { MetricsContainerImpl metricsContainerImpl = new MetricsContainerImpl("stepName"); MetricsContainerImpl equal = new MetricsContainerImpl("stepName"); Assert.assertEquals(metricsContainerImpl, equal); Assert.assertEquals(metricsContainerImpl.hashCode(), equal.hashCode()); }