testing - My concateneate in groovy dont work -


i have question, how can concatenate way file

import java.util.properties def groovyutils = new com.eviware.soapui.support.groovyutils(context) def path = groovyutils.projectpath  properties properties = new properties(); file propertiesfile = (path + jsonconfig.properties); log.info propertiesfile propertiesfile.withinputstream {    stream -> properties.load(stream); }  iterator = properties.keyset().iterator();  while(iterator.hasnext()) {        key = iterator.next();        value = properties[key];         testrunner.testcase.testsuite.project.setpropertyvalue(key, value); } 

the error:

org.codehaus.groovy.runtime.typehandling.groovycastexception: cannot cast object 'e:\jsonconfig.properties' class 'java.lang.string' class 'java.io.file' error @ line: 9 

path + jsonconfig.properties appears string. might want call file constructor. replace:

file propertiesfile = (path + jsonconfig.properties); 

with:

file propertiesfile = new file(path + jsonconfig.properties); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -