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
RedundantListenerException when updating to mockito 3.2.4 with parallel test execution #1857
Comments
Thank you for reporting! |
What version you are migrating from? |
I dug into this issue here's what happens. When Maven Surefire plugin executes the tests with parallel "suitesAndClasses" feature I see an interesting symptom:
We expect the same thread to "start" the test and "finish" it. Internally, Mockito uses "ThreadLocal" to protect global state (global state is required to accommodate nice & sweet Mocking API). What's next?
Thoughts? |
Hi! Thank you for taking a look :) |
I had the same issue with surefire (3.0.0-M5) parallel execution. |
Had the same issue when upgrading to 3.5.0 from 2.25.1. Changing the surefire |
I encountered the same issue when migrating from Mockito 1.x to Mockito 3.5.11 My project uses JUnit 4.13 and the maven-surefire-plugin. We utilize this Surefire configuration option:
I was able to eliminate the RedundantListenerException by changing
|
Any news to this? |
I found out something very interesting: |
Hi!
I am trying to update a codebase to mockito 3.2.4!
After the update some tests fail with
I was able to find out that the tests do not fail if I change the configuration of the
maven-surefire-plugin
to not run test in parallel.The codebase uses
maven-surefire-plugin 2.22.1
maven-compiler-plugin 3.8.0
junit 4.12
java 1.8
I created an example project which reproduces the problem
https://github.com/julius-d/mockito-upgrade-problem
clone it and run
mvn test
It will fail with
RedundantListenerException
The tests do nothing special, they only waste time:
Note that some configuration are impossible to mock via Mockito
(same as any question on stackoverflow.com)
The text was updated successfully, but these errors were encountered: