BucketConfig { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof BucketConfig)) { return false; } final BucketConfig that = (BucketConfig) o; return timeUnit == that.timeUnit && Arrays.equals(buckets, that.buckets); } BucketConfig(Builder builder); TimeUnit getTimeUnit(); String getTimeUnitAbbreviation(); long[] getBuckets(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() throws Exception { BucketConfig config1 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 9}) .build(); BucketConfig config2 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 9}) .build(); BucketConfig config3 = new BucketConfig.Builder() .withTimeUnit(TimeUnit.SECONDS) .withBuckets(new long[]{7, 8, 91}) .build(); assertNotNull(config1); assertFalse(config1.toString().equals(config3.toString())); assertTrue(config1.equals(config1)); assertTrue(config1.equals(config2)); assertFalse(config1.equals(config3)); }