use of org.evosuite.runtime.testdata.EvoSuiteAddress in project evosuite by EvoSuite.
the class LocalAddressPrimitiveStatement method getTestCode.
@Override
public String getTestCode(String varName) {
String testCode = "";
VariableReference retval = getReturnValue();
Object value = getValue();
if (value != null) {
String escapedAddress = StringUtil.getEscapedString(((EvoSuiteAddress) value).getHost());
int port = ((EvoSuiteAddress) value).getPort();
testCode += ((Class<?>) retval.getType()).getSimpleName() + " " + varName + " = new " + ((Class<?>) retval.getType()).getSimpleName() + "(\"" + escapedAddress + "\", " + port + ");\n";
} else {
testCode += ((Class<?>) retval.getType()).getSimpleName() + " " + varName + " = null;\n";
}
return testCode;
}
use of org.evosuite.runtime.testdata.EvoSuiteAddress in project evosuite by EvoSuite.
the class RemoteAddressPrimitiveStatement method getTestCode.
@Override
public String getTestCode(String varName) {
String testCode = "";
VariableReference retval = getReturnValue();
Object value = getValue();
if (value != null) {
String escapedAddress = StringUtil.getEscapedString(((EvoSuiteAddress) value).getHost());
int port = ((EvoSuiteAddress) value).getPort();
testCode += ((Class<?>) retval.getType()).getSimpleName() + " " + varName + " = new " + ((Class<?>) retval.getType()).getSimpleName() + "(\"" + escapedAddress + "\", " + port + ");\n";
} else {
testCode += ((Class<?>) retval.getType()).getSimpleName() + " " + varName + " = null;\n";
}
return testCode;
}
Aggregations