IntegerValue implements Value<Integer> { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof IntegerValue)) { return false; } IntegerValue other = (IntegerValue) obj; if (value == null) { if (other.value != null) { return false; } } else if (!value.equals(other.value)) { return false; } return true; } IntegerValue(Integer value); @Override Double getDouble(); @Override Integer getValue(); @Override void setValue(Integer value); @Override int compareTo(Value<Integer> arg); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void equalsTest() { IntegerValue dnull = new IntegerValue(null); IntegerValue dnull1 = new IntegerValue(null); IntegerValue d1 = new IntegerValue(1); IntegerValue d11 = new IntegerValue(1); IntegerValue d2 = new IntegerValue(2); Assert.assertEquals(d1, d1); Assert.assertEquals(d1, d11); Assert.assertEquals(dnull, dnull1); Assert.assertNotEquals(dnull, d1); Assert.assertNotEquals(d1, null); Assert.assertNotEquals(d1, "a string"); Assert.assertNotEquals(d1, dnull); Assert.assertNotEquals(d1, d2); }