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
Allow spying on interfaces so that it is convenient to work with Java 8 default methods #942
Conversation
Codecov Report
@@ Coverage Diff @@
## release/2.x #942 +/- ##
=================================================
+ Coverage 86.56% 86.58% +0.02%
+ Complexity 2254 2252 -2
=================================================
Files 289 289
Lines 5738 5733 -5
Branches 663 662 -1
=================================================
- Hits 4967 4964 -3
+ Misses 582 581 -1
+ Partials 189 188 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intention is good. Could you update the core Mockito documentation regarding this change? Also would like to see some tests specifically for Java 8. Unsure how we can do that for release/2.x though :(
@@ -59,19 +59,16 @@ public void should_init_spy_and_automatically_create_instance() throws Exception | |||
} | |||
|
|||
@Test | |||
public void should_prevent_spying_on_interfaces() throws Exception { | |||
public void should_allow_spying_on_interfaces() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thank you for updating the test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost merged it when I read @TimvdLippe comment on documentation :) I request documentation update only. See the checkbox in #680 regarding docs.
Thank you for the code! It's a nice improvement for Java 8 users.
@TimvdLippe, I'm ok with not having dedicated coverage for Java8 in release/2.x. We don't have a way of doing it right now so I would not want to block this PR. |
We did have some tests for Java 8 in release 2. So it can be done. But lets drop it as requirement for this PR. |
Thanks for review! Let me know if the javadoc change looks okay to you. |
@@ -1008,7 +1008,7 @@ | |||
* | |||
* | |||
* | |||
* <h3 id="30">30. <a class="meaningful_link" href="#spying_abstract_classes" name="spying_abstract_classes">Spying or mocking abstract classes (Since 1.10.12)</a></h3> | |||
* <h3 id="30">30. <a class="meaningful_link" href="#spying_abstract_classes" name="spying_abstract_classes">Spying or mocking abstract classes (Since 1.10.12) and Java 8 default methods (Since release 2.x)</a></h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice and clean! Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Restarted the Travis CI jobs and will merge as soon as they are green! |
Fixes #680