-
Notifications
You must be signed in to change notification settings - Fork 11
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
Bug with throwing exception from void method using WithBDDMockito #7
Comments
What Mockito and Mockito-Java8 versions do you use? |
(as I'm not able to reproduce it with Mockito 2.0.44-beta and mockito-java8 2.0.0-beta) |
I am using Mockito 2.042-beta and mockito-java8 2.0.0-beta. But I also tried with 2.0.44 and it still is an issue.
|
In the end I found a reason. Btw, your code works fine when put into the mockito-java8 project itself as a test. I was needed to create a separate project to reproduce that issue... Thanks for your report. |
Very odd about it working in the project and not externally. Thanks for Nick On Tue, Mar 22, 2016 at 6:38 PM Marcin Zajączkowski <
|
I don't like unexplained situations, so I had looked into the case and I found that even with a little bit different method signatures with varargs the compiler is able to generate valid byte code by converting my:
into
I suspected enhancements in the compiler, but I wasn't able to reproduce it with very early Java 8 versions. In the end I have found that mockito-java8 2.0.0-beta.1 was built using mockito 2.0.22-beta as a dependency and in 2.0.32-beta the signatures was changed. Therefore your test case works fine from the project itself (with 2.0.44-beta compiler adjusted the code, with 2.0.22-beta API matched) and the problem only occurs with the original 2.0.0-beta.1 jar built with old method signatures in Mockito . The new version would be probably incompatible with Mockito <2.0.32 (if changed methods are called). |
The fix is available in 2.0.0-beta.2. |
The following code will cause java.lang.NoSuchMethodError instead of actually throwing the exception.
The text was updated successfully, but these errors were encountered: