-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
staticMock() and singletons #2153
Comments
Edit: Updated the SSCCE by adding yet another workaround to fix this issue (could help investigating what's wrong here) |
I meet the same problem as you when using mockito-inline:4.9.0. My test code as folowing
When I executed each use case individually, it's successful. If all tests run together, the latter two use cases will always fail |
Environment
Windows 10 64-bit, Java 14.0.2 x64, mockito-inline 3.6.28, JUnit 5.7.0
Short, Self Contained, Correct (Compilable), Example
http://femtopedia.de/SSCCE.zip
Issue
When we run the given tests, one of them will fail, which shouldn't. I am not entirely sure, what the actual issue is here, but I assume, it has to do with the use of singletons.
When we change the order of the tests or don't use mocking on the objects/classes, the tests pass without issues.
Also, if we "initialize" the singleton before all tests run, the tests also pass.
The text was updated successfully, but these errors were encountered: