PeakRateCounter extends AbstractMonitor<Number> implements Counter { @Override public int hashCode() { int result = getConfig().hashCode(); final long n = Double.doubleToLongBits(getValue().doubleValue()); result = 31 * result + (int) (n ^ (n >>> 32)); return result; } PeakRateCounter(MonitorConfig config);   PeakRateCounter(MonitorConfig config, Clock clock); @Override Number getValue(int pollerIdx); @Override boolean equals(Object obj); @Override int hashCode(); String toString(); @Override void increment(); @Override void increment(long amount);  }
@Test public void testEqualsAndHashCodeName() throws Exception { PeakRateCounter c1 = newInstance("1234567890"); PeakRateCounter c2 = newInstance("1234567890"); assertEquals(c1, c2); assertEquals(c1.hashCode(), c2.hashCode()); c2 = c1; assertEquals(c2, c1); }