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
Rework spying on concrete instances #800
Conversation
Codecov Report
@@ Coverage Diff @@
## master #800 +/- ##
============================================
- Coverage 74.43% 74.42% -0.02%
- Complexity 3321 3324 +3
============================================
Files 359 359
Lines 10344 10355 +11
Branches 1288 1291 +3
============================================
+ Hits 7700 7707 +7
- Misses 2176 2178 +2
- Partials 468 470 +2
Continue to review full report at Codecov.
|
@twicksell I'd like you to review it, since you did the original implementation with #695 |
@@ -113,6 +113,18 @@ class JavaSpies extends Specification { | |||
result == "singing, singing" | |||
} | |||
|
|||
def "sping on concrete instances can use partial mocking"() { |
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.
You could link to #771 here (@Issue
)
@@ -69,11 +76,15 @@ public void run() { | |||
} | |||
|
|||
IProxyBasedMockInterceptor mockInterceptor = new GroovyMockInterceptor(configuration, specification, newMetaClass); | |||
ArrayList<Class<?>> additionalInterfaces = new ArrayList<>(configuration.getAdditionalInterfaces()); | |||
List<Class<?>> additionalInterfaces = new ArrayList<>(configuration.getAdditionalInterfaces()); |
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.
Not related, but it could be inlined
import org.spockframework.mock.MockImplementation; | ||
import org.spockframework.mock.MockNature; | ||
import org.spockframework.runtime.GroovyRuntimeUtil; | ||
import org.spockframework.util.ReflectionUtil; |
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.
+1 for not using *-import
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.
actually that is something that I still need to fix, the new "official" style will prefer *-imports if it is more than 3 IIRC
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 tended to like *-imports in the past, but over time I realized that it can hide complexity of a given class, regarding number of class level dependencies. There could be 5 star imports which under the hood import 40+ classes. While in some technical/utility/controller classes it can be fine/sane/required, usually it is good to be aware of that (especially that Idea hides imports by default, so it's doesn't reduce readability or effectiveness of working with that files). That's my two cents.
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.
LGTM
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.
LGTM!
38c58e2
to
4943565
Compare
This fixes #771