Skip to content
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

Added 'lenient' annotation toggle #1523

Merged
merged 2 commits into from
Nov 19, 2018
Merged

Added 'lenient' annotation toggle #1523

merged 2 commits into from
Nov 19, 2018

Conversation

mockitoguy
Copy link
Member

This way we can conveniently configure an existing 'lenient' setting via an annotation. See the unit test that describes the feature.

@Mock(lenient = true) SomeClass mock;

@codecov-io
Copy link

codecov-io commented Oct 25, 2018

Codecov Report

Merging #1523 into release/2.x will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@                Coverage Diff                @@
##             release/2.x    #1523      +/-   ##
=================================================
+ Coverage          88.59%   88.59%   +<.01%     
- Complexity          2401     2402       +1     
=================================================
  Files                299      299              
  Lines               6039     6041       +2     
  Branches             733      734       +1     
=================================================
+ Hits                5350     5352       +2     
  Misses               510      510              
  Partials             179      179
Impacted Files Coverage Δ Complexity Δ
...nternal/configuration/MockAnnotationProcessor.java 100% <100%> (ø) 8 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7799c46...7fd9a23. Read the comment docs.

@@ -76,4 +76,6 @@
Class<?>[] extraInterfaces() default {};

boolean serializable() default false;

boolean lenient() default false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a more a general point, but we probably should add mockSettings here and not have all arguments duplicated in the annotation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think so? It is very nice and clean to configure the parameters directly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we duplicate all values from mockSettings into this annotation. That feels brittle and easy-to-forget.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair.

I don't see what's brittle here - this is public API that we don't change. We can forget to add annotation but... so what... our users will remind us and they can always submit a PR.

It's a rather small trade-off for having a good looking API :)

@mockitoguy
Copy link
Member Author

Thank you for feedback. I'll add documentation and merge it.

This way we can conveniently configure an existing 'lenient' setting via an annotation. See the unit test that describes the feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants