Skip to content

Darkvater/mockito-groovy-support

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Why?

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

How do you use it?

There are two ways.

The less helpful way that requires less setup.

Where you would have said:

MyClass mockObject = Mockito.mock(MyClass.class)

now you say:

MyClass mockObject = MockitoGroovy.gmock(MyClass.class)

The more helpful way that takes more setup.

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.

Where can I get it?

Go to the Downloads tab and download the jar.

Who made this?

Moss Collum and Laura Dean of Cyrus Innovation.

Email us at: mockito-groovy-developers@cyruslists.com

About

A library for making Mockito work with Groovy

Resources

License

Stars

Watchers

Forks

Packages

No packages published