I am trying to create a unit test on Android that uses the mockito-all-1.8.5.jar file from mockito.org. I added the jar file to my project using project> properties> project build path> add external jar. This always worked for me on projects other than Android.
However, when I run unit test, I get the following class exception:
java.lang.ClassNotFoundException: org.mockito.runners.VerboseMockitoJUnitRunner
Above is the following message:
Unable to load class. Make sure it is in your pharmacy. Class name: 'org.mockito.runners.VerboseMockitoJUnitRunner'. Message: org.mockito.runners.VerboseMockitoJUnitRunner
I checked the jar and the class is there.
I also tried adding at this link:
How to use and pack a JAR file with my Android application?
But, still no luck. How can I find this class?
Edit: I think there is a problem with any libraries that Mockitto depends on - they may not be compatible with jalm Dalvik. View this post:
http://daverog.wordpress.com/2009/12/14/why-android-isnt-ready-for-tdd-and-how-i-tried-anyway/
1) Import a fake framework (e.g. mockito) into the project as an additional dependency. Any imported jars containing class files that are not compiled into Dalvik bytecode (most) will not work. Attempting to compile the source with your project will not work, because most libraries will make extensive use of parts of the Java language that are incompatible with Dalvik: it uses its own library, built on a subset of the Java Apache Harmony implementation.
source share