jtanistra / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Failed to instantiate @Unroll naming pattern caused by variable named 'value' #200

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using the following versions:
  groovy 'org.codehaus.groovy:groovy-all:1.8.1'
  testCompile 'org.spockframework:spock-core:0.6-groovy-1.8-SNAPSHOT'

1.  With this test case defined in src/test/groovy:

@Unroll({"value is a bad variable name '$value'"})  
def "value is a  bad variable name"() {
   expect: 
      value + 1 == value + 1
   where: 
      [value] << [[1], [2], [3]]
}

2.  run "gradle test"

org.spockframework.runtime.extension.ExtensionException: Failed to instantiate 
@Unroll naming pattern
    at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:173)
    at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:173)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:86)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:48)
    at org.gradle.messaging.dispatch.DiscardOnFailureDispatch.dispatch(DiscardOnFailureDispatch.java:31)
    at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:129)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NoSuchMethodException: 
onair.exampletests.spock.HelloSpock$_$spock_feature_0_2_closure3.<init>(java.lan
g.Object, java.lang.Object)
    at java.lang.Class.getConstructor0(Class.java:2706)
    at java.lang.Class.getConstructor(Class.java:1657)
    ... 15 more

Original issue reported on code.google.com by miehe.ri...@gmail.com on 16 Sep 2011 at 4:05

GoogleCodeExporter commented 8 years ago
As discussed on the mailing list, using a data variable named 'value' works 
fine.

Original comment by pnied...@gmail.com on 4 Oct 2011 at 7:47