### Question:
RpcResponseKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RpcResponseKey other = (RpcResponseKey) obj; if (outputClazz == null) { if (other.outputClazz != null) { return false; } } else if (!outputClazz.equals(other.outputClazz)) { return false; } else if (xid != other.getXid()) { return false; } return true; } RpcResponseKey(long xid, String outputClazz); long getXid(); String getOutputClazz(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testEquals(){ long xid1 = 12L; long xid2 = 66L; String outputClazz1 = "Clazz01"; String outputClazz2 = "Clazz02"; RpcResponseKey key1 = new RpcResponseKey(xid1, null); RpcResponseKey key2 = new RpcResponseKey(xid2, outputClazz2); Assert.assertTrue("Wrong equal to same obejct.", key1.equals(key1)); Assert.assertFalse("Wrong equal to null.", key1.equals(null)); Assert.assertFalse("Wrong equal to different type.", key1.equals(new Object())); Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2)); key1 = new RpcResponseKey(xid1, outputClazz1); Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2)); key2 = new RpcResponseKey(xid2, outputClazz1); Assert.assertFalse("Wrong equal.", key1.equals(key2)); key1 = new RpcResponseKey(xid2, outputClazz1); Assert.assertTrue("Wrong equal.", key1.equals(key2)); }