### Question:
EnhancedMessageCodeKey extends MessageCodeKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } EnhancedMessageCodeKey other = (EnhancedMessageCodeKey) obj; if (msgType2 != other.msgType2) { return false; } return true; } EnhancedMessageCodeKey(short version, int value, int value2, Class<?> clazz); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testEquals() { EnhancedMessageCodeKey key1 = new EnhancedMessageCodeKey(EncodeConstants.OF10_VERSION_ID, 4, 8, BarrierInput.class); Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1)); Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object())); }