You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to spockfr...@googlegroups.com
Is there something obviously wrong with the following:
41 static Exchange mockExchange(body, Map headers) {
42 Exchange x = Mock()
43 def out = Mock(Message)
44 if(body) out.body >> body
45 out.headers >> headers
46 x.out >> out
47 return x
48 }
Gives the following exception:
| Error Error executing script TestApp: (class:
frontlinesms2/WebConnectionServiceSpec, method: mockExchange
signature: (Ljava/lang/Object;Ljava/util/Map;)Lorg/apache/camel/Exchange;)
Incompatible type for getting or setting field (NOTE: Stack trace has
been filtered. Use --verbose to see entire trace.)
java.lang.VerifyError: (class: frontlinesms2/WebConnectionServiceSpec,
method: mockExchange signature:
(Ljava/lang/Object;Ljava/util/Map;)Lorg/apache/camel/Exchange;)
Incompatible type for getting or setting field
at org.spockframework.runtime.SpecUtil.getFeatureCount(SpecUtil.java:85)
at org.spockframework.runtime.SpecUtil$getFeatureCount.call(Unknown Source)
at grails.plugin.spock.test.GrailsSpecTestType$_doPrepare_closure2.doCall(GrailsSpecTestType.groovy:61)
at grails.plugin.spock.test.GrailsSpecTestType.doPrepare(GrailsSpecTestType.groovy:61)
at _GrailsTest_groovy$_run_closure4.doCall(_GrailsTest_groovy:282)
at _GrailsTest_groovy$_run_closure4.call(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure2.doCall(_GrailsTest_groovy:248)
at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:195)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:184)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at TestApp$_run_closure1.doCall(TestApp.groovy:82)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at java_util_concurrent_Callable$call.call(Unknown Source)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:591)
at gant.Gant.executeTargets(Gant.groovy:590)
Removing `static` seems to fix it...
Peter Niederwieser
unread,
Sep 26, 2012, 10:53:27 AM9/26/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to spockfr...@googlegroups.com
Mocks can't be used in static context. Not nice that it gives a VerifyError, though. Mind to file an issue?
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to spockfr...@googlegroups.com
On 26 September 2012 17:53, Peter Niederwieser <pnie...@gmail.com> wrote:
> Mocks can't be used in static context. Not nice that it gives a VerifyError, though. Mind to file an issue?