### Question:
Handle { @Override public boolean equals(final Object object) { if (object == this) { return true; } if (!(object instanceof Handle)) { return false; } Handle handle = (Handle) object; return tag == handle.tag && isInterface == handle.isInterface && owner.equals(handle.owner) && name.equals(handle.name) && descriptor.equals(handle.descriptor); } @Deprecated  Handle(final int tag, final String owner, final String name, final String descriptor);  Handle(
      final int tag,
      final String owner,
      final String name,
      final String descriptor,
      final boolean isInterface); int getTag(); String getOwner(); String getName(); String getDesc(); boolean isInterface(); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testEquals() { Handle handle1 = new Handle(Opcodes.H_GETFIELD, "owner", "name", "descriptor", false); Handle handle2 = new Handle(Opcodes.H_GETFIELD, "owner", "name", "descriptor", false); Handle nullHandle = null; final boolean equalsThis = handle1.equals(handle1); final boolean equalsSame = handle1.equals(handle2); final boolean equalsNull = handle1.equals(nullHandle); final boolean equalsHandleWithDifferentTag = handle1.equals(new Handle(Opcodes.H_PUTFIELD, "owner", "name", "descriptor", false)); final boolean equalsHandleWithDifferentOwner = handle1.equals(new Handle(Opcodes.H_GETFIELD, "o", "name", "descriptor", false)); final boolean equalsHandleWithDifferentName = handle1.equals(new Handle(Opcodes.H_GETFIELD, "owner", "n", "descriptor", false)); final boolean equalsHandleWithDifferentDescriptor = handle1.equals(new Handle(Opcodes.H_GETFIELD, "owner", "name", "d", false)); final boolean equalsHandleWithDifferentIsInterface = handle1.equals(new Handle(Opcodes.H_GETFIELD, "owner", "n", "descriptor", true)); assertTrue(equalsThis); assertTrue(equalsSame); assertFalse(equalsNull); assertFalse(equalsHandleWithDifferentTag); assertFalse(equalsHandleWithDifferentOwner); assertFalse(equalsHandleWithDifferentName); assertFalse(equalsHandleWithDifferentDescriptor); assertFalse(equalsHandleWithDifferentIsInterface); }
@Test public void testEquals() { Handle handle1 = new Handle(Opcodes.H_GETFIELD, "owner", "name", "descriptor", false); Handle handle2 = new Handle(Opcodes.H_GETFIELD, "owner", "name", "descriptor", false); assertEquals(handle1, handle1); assertEquals(handle1, handle2); assertNotEquals(handle1, null); assertNotEquals(handle1, new Handle(Opcodes.H_PUTFIELD, "owner", "name", "descriptor", false)); assertNotEquals(handle1, new Handle(Opcodes.H_GETFIELD, "o", "name", "descriptor", false)); assertNotEquals(handle1, new Handle(Opcodes.H_GETFIELD, "owner", "n", "descriptor", false)); assertNotEquals(handle1, new Handle(Opcodes.H_GETFIELD, "owner", "name", "d", false)); assertNotEquals(handle1, new Handle(Opcodes.H_GETFIELD, "owner", "n", "descriptor", true)); }