You're using Mockito and Groovy. Maybe you've noticed that, when you try to mock a Groovy class from a Groovy test, it fails horribly. Now it won't!
Specifically, this library provides a workaround for Mockito Issue 303: http://code.google.com/p/mockito/issues/detail?id=303
There are two ways.
Where you would have said:
MyClass mockObject = Mockito.mock(MyClass.class)
now you say:
MyClass mockObject = MockitoGroovy.gmock(MyClass.class)
Override your Mockito configuration, by creating a new class called
org.mockito.configuration.MockitoConfiguration
. It has to have that exact name, including the package,
and it should look like this:
package org.mockito.configuration;
import com.cyrusinnovation.mockitogroovysupport.GroovyMockitoConfiguration;
public class MockitoConfiguration extends GroovyMockitoConfiguration {
}
From then on, everything should just work. If it doesn't, let us know.
Go to the Downloads tab and download the jar.
Moss Collum and Laura Dean of Cyrus Innovation.
Email us at: [email protected]