### Question:
Method { @Override public boolean equals(final Object other) { if (!(other instanceof Method)) { return false; } Method otherMethod = (Method) other; return name.equals(otherMethod.name) && descriptor.equals(otherMethod.descriptor); } Method(final String name, final String descriptor);  Method(final String name, final Type returnType, final Type[] argumentTypes); static Method getMethod(final java.lang.reflect.Method method); static Method getMethod(final java.lang.reflect.Constructor<?> constructor); static Method getMethod(final String method); static Method getMethod(final String method, final boolean defaultPackage); String getName(); String getDescriptor(); Type getReturnType(); Type[] getArgumentTypes(); @Override String toString(); @Override boolean equals(final Object other); @Override int hashCode();  }### Answer:
@Test public void testEquals() { Method nullMethod = null; boolean equalsNull = new Method("name", "()V").equals(nullMethod); boolean equalsMethodWithDifferentName = new Method("name", "()V").equals(new Method("other", "()V")); boolean equalsMethodWithDifferentDescriptor = new Method("name", "()V").equals(new Method("name", "(I)J")); boolean equalsSame = new Method("name", "()V").equals(Method.getMethod("void name()")); assertFalse(equalsNull); assertFalse(equalsMethodWithDifferentName); assertFalse(equalsMethodWithDifferentDescriptor); assertTrue(equalsSame); }
@Test public void testEquals() { assertNotEquals(new Method("name", "()V"), null); assertNotEquals(new Method("name", "()V"), new Method("other", "()V")); assertNotEquals(new Method("name", "()V"), new Method("name", "(I)J")); assertEquals(new Method("name", "()V"), Method.getMethod("void name()")); }