Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Mockito Issue? #74

taylorleese opened this Issue · 5 comments

2 participants


Curious if you've ever encountered exceptions similar to the following when using Mockito with Specs2? I'm currently having issues with below. I'm getting this while running an immutable spec using MockitoMocker (specs2 1.9) on a Jenkins build. Everything seems to run fine in IntelliJ.

null ( 

Yes, this looks like a pure Mockito issue. You can verify that by calling only org.mockito.Mockito.mock.

Could you be passing a null class to be mocked in your code?


I wish it were that simple. I'm actually receiving it while trying to mock a Netty HttpRequest so it's not even a Scala class being mocked. It's a Java interface. It also works fine in IntelliJ (specs pass) and then fails in our Jenkins builds. It's all very obscure which is one of the reasons I was looking at patching the maven specs2 plugin the other day.


What happens if you create a small java project mocking the same code and running on Jenkins? Does that work ok? The other thing you can check is the mockito version. Maybe it's an old one coming from the maven-specs2 plugin?


You'll notice in my pull request for the maven specs2 plugin I also bumped the mockito version to 1.9.0 ( However, that didn't fix my mockito issue. Unfortunately, I haven't been able to find a simple base case that reproduces the issue. I've definitely been trying to do that. However, I was able to reproduce the problem running maven from the command line locally so I believe it's related to some sort of classpath issue, but I haven't been able to find anything pulling in a different version of mockito other than 1.9.0. I've run the maven dependency tree plugin to look for anything and didn't find anything there either. I've been e-mailing with one of the mockito authors also trying to figure out what is going on. However, it seems like the mockito folks are not well versed in Scala and seem to punt on issues related to it, unfortunately.


Can you try to call the same code (more or less) from a JUnit test case, have it compiled and run with the maven plugin? Then you would have a reproducible test case for the Mockito team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.