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

Mocks created by JUnit4 tests are not cleaned up when run with JUnit5 #734

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tsmock
Copy link

@tsmock tsmock commented Sep 8, 2022

Please provide the following information:

Problem code:
https://github.com/jmockit/jmockit1/blob/master/main/src/mockit/internal/startup/JMockitInitialization.java#L34

Workaround for non-patched releases:
Create a new mockit.internal.state.SavePoint before each test (i.e., in a @Before method) and then call the rollback method in an @After method. See https://josm.openstreetmap.de/changeset/18551/josm/ for an example using a custom TestRule.

  • Check the following:
  • If a defect or unexpected result, JMockit project members should be able to reproduce it.
    For that, include an example test (perhaps accompanied by a Maven/Gradle build script) which
    can be executed without changes and reproduces the failure.

  • If an enhancement or new feature request, it should be justified by an example test
    demonstrating the validity and usefulness of the desired enhancement or new feature.

  • The issue does not fall outside the scope of the project (for example, attempting to use
    JMockit APIs from Groovy or Scala code, or with an Android runtime).

  • The JDK where the problem occurs is a final release, not a development build.

Additionally search classpath for the VintageTestEngine, which is what is used to run JUnit4 tests under JUnit5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants