Forum Discussion
"${= new Random.nextInt(1, 1000)}"
Throws me the below error . when i have it this way "id": "${= new Random.nextInt(1, 1000)}" ,
"startup failed:
Script3.groovy: 1: unable to resolve class Random.nextInt
@ line 1, column 2.
new Random.nextInt(1, 1000)
^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class Random.nextInt
@ line 1, column 2.
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:149)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:264)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:274)
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1049)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:708)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1320)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:203)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1263)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:178)
at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:694)
at groovy.lang.GroovyShell.parse(GroovyShell.java:706)
at groovy.lang.GroovyShell.parse(GroovyShell.java:742)
at groovy.lang.GroovyShell.parse(GroovyShell.java:733)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.recompileWithNewName(SoapUIGroovyScriptEngine.java:155)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:146)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:95)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:79)
at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:165)
at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolver.java:145)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:212)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:155)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:151)
at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:134)
at com.eviware.soapui.impl.wsdl.submit.filters.PropertyExpansionRequestFilter.filterAbstractHttpRequest(PropertyExpansionRequestFilter.java:47)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:34)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.filterRequest(HttpClientRequestTransport.java:410)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:193)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:126)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
- nmrao8 years agoChampion Level 3Sorry, there was typo.
Change from:
${= new Random.nextInt(1, 1000)}
to
${= new Random().nextInt(1, 1000)}- Sriraj8 years agoContributor
Hi,
"id": ${= new Random().nextInt(1,1000)},
The above format when used throws the below error .
"id": No signature of method: java.util.Random.nextInt() is applicable for argument types: (java.lang.Integer, java.lang.Integer) values: [1, 1000]
Possible solutions: nextInt(), nextInt(int), nextLong(), nextFloat(), notify()
Related Content
- 5 years ago
- 2 years ago
Recent Discussions
- 18 hours ago
- 17 days ago