Repository navigation
Conversation
a20a92e to
853e2be
Compare
Codecov Report
@@ Coverage Diff @@
## master #1134 +/- ##
============================================
- Coverage 75.01% 75.00% -0.01%
- Complexity 3526 3528 +2
============================================
Files 388 388
Lines 10872 10876 +4
Branches 1347 1348 +1
============================================
+ Hits 8156 8158 +2
- Misses 2245 2247 +2
Partials 471 471
Continue to review full report at Codecov.
|
46d3775 to
ef0338f
Compare
f545f05 to
1ad4178
Compare
1ad4178 to
0e602fb
Compare
leonard84
left a comment
There was a problem hiding this comment.
Reviewed 8 of 8 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Vampire)
spock-core/src/main/java/org/spockframework/mock/runtime/GroovyMockInterceptor.java, line 48 at r1 (raw file):
// we do not need the cast information from the wrappers here, the method selection // is already done, so unwrap the argument array if there are still wrappers present arguments = GroovyRuntimeUtil.asUnwrappedArgumentArray(arguments);
Parameters should be treated as final, even if we omit the final everywhere to avoid clutter. Even if some old code did that, we should clean it up.
spock-core/src/main/java/org/spockframework/mock/runtime/GroovyMockMetaClass.java, line 65 at r1 (raw file):
asArgumentArray
Isn't this redundant here? arguments are already an array.
spock-core/src/main/java/org/spockframework/mock/runtime/JavaMockInterceptor.java, line 53 at r1 (raw file):
asArgumentArray
Isn't this redundant here? arguments are already an array.
spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java, line 228 at r1 (raw file):
public static Object[] asUnwrappedArgumentArray(Object args) { return InvokerHelper.asUnwrappedArray(InvokerHelper.asArray(args).clone());
Maybe document that it does clone the array.
spock-specs/src/test/groovy/org/spockframework/smoke/mock/GroovySpiesThatAreGlobal.groovy, line 244 at r1 (raw file):
when: PersonWithOverloadedMethods.perform(_) >> "Foo"
Maybe split here into a new test, as the result changes and it is not directly obvious.
Can we do this data-driven, or does it not work/reproduce the problem?
where:
action | result
{ PersonWithOverloadedMethods.perform("null string" as String) } | 'String'
Vampire
left a comment
There was a problem hiding this comment.
Reviewable status: 3 of 8 files reviewed, 5 unresolved discussions (waiting on @leonard84)
spock-core/src/main/java/org/spockframework/mock/runtime/GroovyMockInterceptor.java, line 48 at r1 (raw file):
Previously, leonard84 (Leonard Brünings) wrote…
Parameters should be treated as final, even if we omit the final everywhere to avoid clutter. Even if some old code did that, we should clean it up.
Done.
spock-core/src/main/java/org/spockframework/mock/runtime/GroovyMockMetaClass.java, line 65 at r1 (raw file):
Previously, leonard84 (Leonard Brünings) wrote…
asArgumentArrayIsn't this redundant here? arguments are already an array.
No, null is translated to an empty array.
It could be replaced by Object[] args = (arguments == null) ? EMPTY_ARGS : arguments though if you prefer.
spock-core/src/main/java/org/spockframework/mock/runtime/JavaMockInterceptor.java, line 53 at r1 (raw file):
Previously, leonard84 (Leonard Brünings) wrote…
asArgumentArrayIsn't this redundant here? arguments are already an array.
Same as above
spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java, line 228 at r1 (raw file):
Previously, leonard84 (Leonard Brünings) wrote…
Maybe document that it does clone the array.
Done.
spock-specs/src/test/groovy/org/spockframework/smoke/mock/GroovySpiesThatAreGlobal.groovy, line 244 at r1 (raw file):
Previously, leonard84 (Leonard Brünings) wrote…
Maybe split here into a new test, as the result changes and it is not directly obvious.
Can we do this data-driven, or does it not work/reproduce the problem?
where: action | result { PersonWithOverloadedMethods.perform("null string" as String) } | 'String'
Hm, maybe I didn't think about closures then.
Changed to two data driven methods.
leonard84
left a comment
There was a problem hiding this comment.
Reviewed 5 of 5 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved
Fixes #871
This change is