My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
MockitoForJvm14  
Updated Oct 7, 2010 by szcze...@gmail.com

If you want to use Mockito with jvm < 1.5 you have 3 options:

1. get all your code upgraded to newer java (c'mon, you've got to do it at some point!)

2. get your test code upgraded to newer java. You don't have to change production code - just set up your IDE & build tool to use jvm 1.5 to compile & run your tests. It may be tricky sometimes (you might need separate projects if you use Eclipse, etc) but there are Mockito users who managed to set it up.

3. Use mockito-all-jvm14-1.8.0.jar. It is maintained by James Carr. It was created using retrotranslator. In jdk14 there are no static imports so Mockito api via static methods makes the code a bit cluttered. To work around that there is an additional class org.mockito.MockitoTestCase that provides methods like mock, verify, etc. Please refer to javadocs or to the mailing list in case you have any questions.

Comment by james.r....@gmail.com, Oct 21, 2009

BTW, MockitoTestCase? really just delegates all of the Mockito. static methods that you normally statically import. So you can use stuff like:

when(foo.doSomething()).thenReturn("foo")

rather than

Mockito.when(...)

Comment by rajiv.ab...@gmail.com, Jun 4, 2010

thanks James Carr ! You are a life saver

Comment by nat...@ncjones.com, Oct 9, 2011

Where's the source for MockitoTestCase?.java? It's missing from mockito-all-jvm14-1.8.0.jar.

Comment by project member szcze...@gmail.com, Nov 1, 2011

Please try to contact James and ask about it. He maintains the mockito jvm14 port. Cheers!


Sign in to add a comment
Powered by Google Project Hosting