-
Notifications
You must be signed in to change notification settings - Fork 238
It seems like JMockit leaves mocked classes behind after test completes #365
Description
I'm using JMockit 1.29 and JUnit 4.11 (with Hamcrest 1.3).
I have a project with about 3000 test methods, most of them in JUnit 3 style test classes (extends TestCase). When trying to add new, independent, tests based on JMockit I see random breakage of some of the old tests. When I get into the debugger I see JMockit interfering. I realize that the JMockit tests do not support Junit3 style API, but the old style test doesn't use anything JMockit related.
The attached file mixing-old-new.zip has a reproducible example. It has a JMockit test, a TestCase test and a domain object that is mocked in the former, not in the latter.
Compile with javac -cp jmockit-1.29.jar:junit-4.11.jar *.java
Running with the old test first succeeds java -cp .:jmockit-1.29.jar:junit-4.11.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore OldStyleTest NewStyleTest
Running with the new test first fails the old test: java -cp .:jmockit-1.29.jar:junit-4.11.jar:hamcrest-core-1.3.jar org.junit.runner.JUnitCore NewStyleTest OldStyleTest
The expectation is of course that the order of the tests don't matter.