### Question:
InstructionSerializerKey extends MessageTypeKey<Instruction> implements ExperimenterSerializerKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof InstructionSerializerKey)) { return false; } InstructionSerializerKey<?> other = (InstructionSerializerKey<?>) obj; if (experimenterId == null) { if (other.experimenterId != null) { return false; } } else if (!experimenterId.equals(other.experimenterId)) { return false; } if (instructionType == null) { if (other.instructionType != null) { return false; } } else if (!instructionType.equals(other.instructionType)) { return false; } return true; } InstructionSerializerKey(short msgVersion, Class<T> instructionType,
            Long experimenterId); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testEquals(){ InstructionSerializerKey<?> key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L); InstructionSerializerKey<?> key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, 42L); Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1)); Assert.assertFalse("Wrong equal to different class.", key1.equals(new Object())); key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, ApplyActionsCase.class, null); Assert.assertFalse("Wrong equal by experimenterId.", key1.equals(key2)); key1 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L); key2 = new InstructionSerializerKey<>(EncodeConstants.OF10_VERSION_ID, null, 42L); Assert.assertTrue("Wrong equal by instructionType.", key1.equals(key2)); }