File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
spock-specs/src/test/groovy/org/spockframework/mock/runtime/mockito Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import org.mockito.exceptions.base.MockitoException
2222import org.spockframework.mock.CannotCreateMockException
2323import org.spockframework.mock.MockUtil
2424import org.spockframework.runtime.InvalidSpecException
25+ import spock.lang.Issue
2526import spock.lang.Shared
2627import spock.lang.Specification
2728import spock.mock.MockMakers
@@ -478,6 +479,18 @@ class MockitoStaticMocksSpec extends Specification {
478479 ex. message. contains(" It is not possible to mock static methods of java.lang.Thread" )
479480 }
480481
482+ @Issue (" https://github.com/spockframework/spock/issues/2161" )
483+ def " SpyStatic with varargs in method" () {
484+ given :
485+ SpyStatic (StaticClass )
486+ StaticClass . staticVarargsMethod(" test" ) >> true
487+ StaticClass . staticVarargsMethod(" test2" ) >> false
488+
489+ expect :
490+ StaticClass . staticVarargsMethod(" test" )
491+ ! StaticClass . staticVarargsMethod(" test2" )
492+ }
493+
481494 static class StaticClass {
482495
483496 String instanceMethod () {
@@ -491,6 +504,11 @@ class MockitoStaticMocksSpec extends Specification {
491504 static String staticMethod2 () {
492505 return REAL_VALUE
493506 }
507+
508+ @SuppressWarnings (' unused' )
509+ static boolean staticVarargsMethod (String str , String ... varargs ) {
510+ return true
511+ }
494512 }
495513
496514 static class StaticClass2 {
You can’t perform that action at this time.
0 commit comments