Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems like JMockit leaves mocked classes behind after test completes #365

Closed
knut-forkalsrud opened this issue Nov 28, 2016 · 0 comments
Assignees

Comments

@knut-forkalsrud
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants