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

#1900 Configure mocks for annotation interfaces with default values from annotation #1901

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ghenzler
Copy link

@ghenzler ghenzler commented Apr 7, 2020

Closes #1900


if(typeToMock.isAnnotation()) {
configureMockWithAnnotationDefaults(typeToMock, mock);
}
Copy link
Author

Choose a reason for hiding this comment

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

This works well but I'm not sure if this is the best position to hook in this functionality - I'm happy to adjust if there is a better position to perform this.

@codecov-io
Copy link

codecov-io commented Apr 7, 2020

Codecov Report

Merging #1901 into release/3.x will decrease coverage by 0.01%.
The diff coverage is 80.00%.

Impacted file tree graph

@@                Coverage Diff                @@
##             release/3.x    #1901      +/-   ##
=================================================
- Coverage          86.67%   86.66%   -0.02%     
- Complexity          2526     2530       +4     
=================================================
  Files                318      318              
  Lines               6650     6660      +10     
  Branches             832      834       +2     
=================================================
+ Hits                5764     5772       +8     
- Misses               685      687       +2     
  Partials             201      201              
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/org/mockito/internal/MockitoCore.java 96.61% <80.00%> (-1.54%) 44.00 <3.00> (+4.00) ⬇️

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 b2de4cc...c7f180f. Read the comment docs.

@@ -62,6 +63,11 @@ public boolean isTypeMockable(Class<?> typeToMock) {
MockCreationSettings<T> creationSettings = impl.build(typeToMock);
T mock = createMock(creationSettings);
mockingProgress().mockingStarted(mock, creationSettings);

if(typeToMock.isAnnotation()) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
if(typeToMock.isAnnotation()) {
if (typeToMock.isAnnotation()) {

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.

Configure mocks for annotation interfaces with default values from annotation
3 participants