### Question:
BasicValue implements Value { @Override public boolean equals(final Object value) { if (value == this) { return true; } else if (value instanceof BasicValue) { if (type == null) { return ((BasicValue) value).type == null; } else { return type.equals(((BasicValue) value).type); } } else { return false; } } BasicValue(final Type type); Type getType(); @Override int getSize(); boolean isReference(); @Override boolean equals(final Object value); @Override int hashCode(); @Override String toString(); static final BasicValue UNINITIALIZED_VALUE; static final BasicValue INT_VALUE; static final BasicValue FLOAT_VALUE; static final BasicValue LONG_VALUE; static final BasicValue DOUBLE_VALUE; static final BasicValue REFERENCE_VALUE; static final BasicValue RETURNADDRESS_VALUE; }### Answer:
@Test public void testEquals() { boolean equalsSameUninitializedValue = new BasicValue(null).equals(BasicValue.UNINITIALIZED_VALUE); boolean equalsSameValue = new BasicValue(Type.INT_TYPE).equals(BasicValue.INT_VALUE); boolean equalsThis = BasicValue.INT_VALUE.equals(BasicValue.INT_VALUE); boolean equalsDifferentClass = BasicValue.INT_VALUE.equals(new Object()); assertTrue(equalsSameUninitializedValue); assertTrue(equalsSameValue); assertTrue(equalsThis); assertFalse(equalsDifferentClass); }
@Test public void testEquals() { assertEquals(new BasicValue(null), BasicValue.UNINITIALIZED_VALUE); assertEquals(new BasicValue(Type.INT_TYPE), BasicValue.INT_VALUE); assertEquals(BasicValue.INT_VALUE, BasicValue.INT_VALUE); assertNotEquals(new Object(), BasicValue.INT_VALUE); }