mockito/mockito — pull request #87 by hughwphamill (2014-09-26 11:10:28+00:00)
Title: Adding more appropriate .equals() method to DelegatingMethod

Currently if you create a DelegatingMethod and compare it to itself using .equals() it will show as not equal because the .equals() method expects a java.lang.reflect.Method (without explicitly stating such). This has a knock on effect on the evaluation of InvocationImpl.equals() which at runtime may be using a DelegatingMethod in its .equals().

I have changed .equals() and .hashCode() in DelegatingMethod to a more appropriate implementation, which can handle both the case where the input object is a DelegatingMethod and where it is a java.lang.reflect.Method.

I ran up against this issue when creating a custom ValidationMode which used InvocationImpl.equals() to check that the appropriate invocation was made. My comparison failed even though I was comparing two references to the same InvocationImpl instance.