Open 1dEraNCeSIv0 opened 1 year ago
Hi, I am a university student and new to contributing. I would love to work on this. If possible could I just get some tips on where to start with this issue? Can you assign this to me?
I'm not part of the mockito team but if I were to try and fix this myself I'd:
Alternative to 3 and 4: If the issue ends up being with byte buddy or some other library used by mockito then I'd instead open a ticket with them (or possibly fix it in their code and create a pull request with them).
Best of luck :)
Checklist:
Issue description
When mocking a class using generics in a particular way Mockito will throw an exception when attempting to mock the class. This only occurs if the class under test uses method reference to refer to a private method; calling the same method using regular lambda syntax will allow the creation of the mock
Versions used
Mockito: 5.3.1 Java: 19 OS: Windows 10
ByteBuddy: 1.14.4 (transitive dependency via Mockito 5.3.1, possibly relevant)
(See also the example project down below, based on a recent spring starter from start.spring.io)
How to reproduce using the appended demo project
Expected
MethodReferenceVariantTest.shouldNeverFail
andLambdaVariantTest.shouldNeverFail
should fail together as the tests and code under test is identical apart from the fact that the the first uses method reference syntax and the latter lambda syntax.What actually happens
The test
LambdaVariantTest.shouldNeverFail
works as expected, butMethodReferenceVariantTest.shouldNeverFail
will fail with the following stacktraceFurther information
If wanting to reproduce without the provided demo project or importing fails somehow the following is the most relevant code:
These 6 classes / interfaces are sufficient to reproduce the issue for me but if more info is required I'm happy to provide it.