cyrusinnovation/mockito-groovy-support — pull request #4 by gogstad (2012-11-08 20:10:33+00:00)
Title: Bugfix #1 and #2

# Brief description
Mockito argument matching and verification don't work with POGOs because of meta classes. This patch handles calls to getMetaClass so that verification and argument matching works. It is not possible to handle meta classes through MockitoConfiguration with the current implementation of Mockito. Therefore users of mockito-groovy-support *must* use MockitoGroovy.gmock in order to mock groovy objects.

# Detailed description
All method invocations on mockito proxies are handled by one or more MethodInterceptors. The default method interceptor is org.mockito.internal.creation.MethodInterceptorFilter. This filter is responsible for handling special methods (such as equals and hashCode) and passing all other method invocations through the mockito jungle of invocations and answers.

The implementation of MethodInceptor that mockito uses to handle method invocations is not configurable. This patch uses MockitoGroovy.gmock as an entry point for creating mocks, and substitutes the default implementation of MethodInterceptor with an implementation that handles meta classes.