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
MockitoExtension cannot handle multiple generic mocks with different parameterized type #1917
Comments
I have the found the same issue when upgrading from 2.15 to 3.1 |
I investigated a little on this problem. The decision is done in ConstructorInjection.java. It does not have the type information atm, since it was lost due to type erasure. The constructor type information could be easily obtained by using That does not seem a small thing to do. Any comments from the maintainers if that would be the way to go or any other suggestions? |
Hi! Checked out the error and I might have a possible fix for it. Could I be assigned to work on this issue? |
added libraryTest and checked that it fails
fixed mockito inject test
removing debug print statements added hashmap test refactored test names
It looks to me as if
MockitoExtension
just checks the base type and does not respect the parameterized type of mocks.This test will fail:
It shows on stdout that the same instance is used for both parameters:
The test then fails with the following error:
Any chance to add support for this?
I am using the following versions:
The text was updated successfully, but these errors were encountered: