-
Notifications
You must be signed in to change notification settings - Fork 463
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 to create Groovy spies with existing instances #1825
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1825 +/- ##
============================================
- Coverage 80.44% 80.33% -0.12%
+ Complexity 4337 4309 -28
============================================
Files 441 439 -2
Lines 13534 13484 -50
Branches 1707 1702 -5
============================================
- Hits 10888 10832 -56
Misses 2008 2008
- Partials 638 644 +6 ☔ View full report in Codecov by Sentry. |
8335e12
to
898512f
Compare
a6b71e1
to
aa2ae90
Compare
898512f
to
a7cd873
Compare
aa2ae90
to
42a42b8
Compare
a7cd873
to
9ee3081
Compare
42a42b8
to
bed0214
Compare
bdf291f
to
e6a1853
Compare
1a546b9
to
18556f9
Compare
|
||
class GroovySpies extends Specification { | ||
def "can spy on concrete instances"() { | ||
def person = GroovySpy(new Person()) |
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.
Is this testing that it works? When you don't customize the instance, how would you notice the difference to the parameter being ignored?
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.
Afair I just ported over the tests from JavaSpies
where it is done the same.
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.
Also, I'm not sure what you mean.
Calling the method on the Spy calls through to the original object.
What should be customized here?
That the Spy can intercept and change things is tested further down.
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 was talking about creating Person
with non-default constructor values. Otherwise, it would behave the same as GroovySpy()
.
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.
What would that change?
The tested method is not influenced by the constructor arguments or any property of the class.
Again, I just ported over the test from JavaSpies
, assuming that whoever invented them had a reason to write them like that.
0139d22
to
473ef9f
Compare
473ef9f
to
15c42b0
Compare
15c42b0
to
af671b7
Compare
No description provided.