### Question:
Type { @Override public boolean equals(final Object object) { if (this == object) { return true; } if (!(object instanceof Type)) { return false; } Type other = (Type) object; if ((sort == INTERNAL ? OBJECT : sort) != (other.sort == INTERNAL ? OBJECT : other.sort)) { return false; } int begin = valueBegin; int end = valueEnd; int otherBegin = other.valueBegin; int otherEnd = other.valueEnd; if (end - begin != otherEnd - otherBegin) { return false; } for (int i = begin, j = otherBegin; i < end; i++, j++) { if (valueBuffer.charAt(i) != other.valueBuffer.charAt(j)) { return false; } } return true; } private  Type(final int sort, final String valueBuffer, final int valueBegin, final int valueEnd); static Type getType(final String typeDescriptor); static Type getType(final Class<?> clazz); static Type getType(final Constructor<?> constructor); static Type getType(final Method method); Type getElementType(); static Type getObjectType(final String internalName); static Type getMethodType(final String methodDescriptor); static Type getMethodType(final Type returnType, final Type... argumentTypes); Type[] getArgumentTypes(); static Type[] getArgumentTypes(final String methodDescriptor); static Type[] getArgumentTypes(final Method method); Type getReturnType(); static Type getReturnType(final String methodDescriptor); static Type getReturnType(final Method method); String getClassName(); String getInternalName(); static String getInternalName(final Class<?> clazz); String getDescriptor(); static String getDescriptor(final Class<?> clazz); static String getConstructorDescriptor(final Constructor<?> constructor); static String getMethodDescriptor(final Type returnType, final Type... argumentTypes); static String getMethodDescriptor(final Method method); int getSort(); int getDimensions(); int getSize(); int getArgumentsAndReturnSizes(); static int getArgumentsAndReturnSizes(final String methodDescriptor); int getOpcode(final int opcode); @Override boolean equals(final Object object); @Override int hashCode(); @Override String toString(); static final int VOID; static final int BOOLEAN; static final int CHAR; static final int BYTE; static final int SHORT; static final int INT; static final int FLOAT; static final int LONG; static final int DOUBLE; static final int ARRAY; static final int OBJECT; static final int METHOD; static final Type VOID_TYPE; static final Type BOOLEAN_TYPE; static final Type CHAR_TYPE; static final Type BYTE_TYPE; static final Type SHORT_TYPE; static final Type INT_TYPE; static final Type FLOAT_TYPE; static final Type LONG_TYPE; static final Type DOUBLE_TYPE; }### Answer:
@Test public void testEquals() { Type nullType = null; final boolean equalsNull = Type.getObjectType("I").equals(nullType); final boolean equalsDifferentTypeSort = Type.getObjectType("I").equals(Type.INT_TYPE); final boolean equalsDifferentObjectType = Type.getObjectType("I").equals(Type.getObjectType("HI")); final boolean equalsOtherDifferentObjectType = Type.getObjectType("I").equals(Type.getObjectType("J")); final boolean equalsSameType = Type.getObjectType("I").equals(Type.getType("LI;")); final boolean equalsSameObjectType = Type.getType("LI;").equals(Type.getObjectType("I")); final boolean equalsSamePrimitiveType = Type.INT_TYPE.equals(Type.getType("I")); assertFalse(equalsNull); assertFalse(equalsDifferentTypeSort); assertFalse(equalsDifferentObjectType); assertFalse(equalsOtherDifferentObjectType); assertTrue(equalsSameType); assertTrue(equalsSameObjectType); assertTrue(equalsSamePrimitiveType); }
@Test public void testEquals() { assertNotEquals(Type.getObjectType("I"), null); assertNotEquals(Type.getObjectType("I"), Type.INT_TYPE); assertNotEquals(Type.getObjectType("I"), Type.getObjectType("HI")); assertNotEquals(Type.getObjectType("I"), Type.getObjectType("J")); assertEquals(Type.getObjectType("I"), Type.getType("LI;")); assertEquals(Type.getType("LI;"), Type.getObjectType("I")); assertEquals(Type.INT_TYPE, Type.getType("I")); }