MutableInt { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MutableInt other = (MutableInt) obj; return value == other.value; } MutableInt();  MutableInt(int value); void set(int value); int get(); void inc(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void equals() { MutableInt integer1 = new MutableInt(2); MutableInt integer2 = new MutableInt(2); MutableInt integer3 = new MutableInt(3); assertThat(integer1).isEqualTo(integer2); assertThat(integer1).isEqualTo(integer1); assertThat(integer1).isNotEqualTo(integer3); }