EventCount { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof EventCount)) { return false; } final EventCount that = (EventCount) o; return success == that.success && failure == that.failure; } private  EventCount(long success, long failure); static EventCount of(long success, long failure); long success(); long failure(); long total(); double successRate(); double failureRate(); @Override int hashCode(); @Override boolean equals(@Nullable Object o); @Override String toString(); static final EventCount ZERO; }
@Test void testEquals() { final EventCount ec = EventCount.of(1, 1); assertThat(ec).isEqualTo(ec); assertThat(EventCount.of(0, 0)).isEqualTo(EventCount.of(0, 0)); assertThat(EventCount.of(1, 0)).isNotEqualTo(EventCount.of(0, 0)); assertThat(EventCount.of(1, 0)).isNotEqualTo(new Object()); }