相关文章推荐
捣蛋的牙膏  ·  Android RecyclerView ...·  1 月前    · 
才高八斗的柳树  ·  How to click on svg ...·  2 月前    · 
闯红灯的爆米花  ·  DevPod - Open Source ...·  6 月前    · 

Forum Discussion

ATokeley
Contributor
13 years ago

Error: Could not find which method getAt() to invoke

Hi there,
I'm suddenly getting the following error when I execute

Tue Jan 25 14:22:00 NZDT 2011:ERROR:org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method getAt() to invoke from this list:
public java.lang.Object java.lang.Object#getAt(java.lang.String)
public java.lang.Object groovy.util.slurpersupport.GPathResult#getAt(groovy.lang.IntRange)
public java.lang.Object groovy.util.slurpersupport.GPathResult#getAt(int)
org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method getAt() to invoke from this list:
public java.lang.Object java.lang.Object#getAt(java.lang.String)
public java.lang.Object groovy.util.slurpersupport.GPathResult#getAt(groovy.lang.IntRange)
public java.lang.Object groovy.util.slurpersupport.GPathResult#getAt(int)
at groovy.lang.MetaClassImpl.chooseMethodInternal(MetaClassImpl.java:2865)
at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2800)
at groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1229)
at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1135)
at groovy.lang.MetaClassImpl.tryListParamMetaMethod(MetaClassImpl.java:1068)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:908)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at Script1.run(Script1.groovy:15)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:88)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:148)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

When I execute the following code:

[code=php:nhdcamcv] import java . util . regex . Matcher
import java
. util . regex . Pattern

def xmlSlurper
= new groovy . util . XmlSlurper ()
def response1
= xmlSlurper . parseText ( context . expand ( '${GET Items#Response}' ));
log . info "Response: " + response1
Pattern myRegex
= ~/^ s *(+|-)?(( d +(. dd )?)|(. dd )) s *$/


def arrayOfItems = response1 . Items . Item
log
. info "Array of Items: " + arrayOfItems
for
( n in arrayOfItems )
{

log . info arrayOfItems []
if ( n . PurchaseDetails != '' ){
log . info " PurchaseDetails: " + n . PurchaseDetails . UnitPrice
Matcher purchaseDetailsMatcher
= myRegex . matcher ( n . PurchaseDetails . UnitPrice . toString ());
assert purchaseDetailsMatcher . matches ()
}

if
( n . SalesDetails != '' ){
log . info " SalesDetails: " + n . SalesDetails . UnitPrice
Matcher salesDetailsMatcher
= myRegex . matcher ( n . SalesDetails . UnitPrice . toString ());
assert salesDetailsMatcher . matches ()
}

}



[/code:nhdcamcv]