use of org.evosuite.testcase.statements.ClassPrimitiveStatement in project evosuite by EvoSuite.
the class TestCaseBuilder method appendClassPrimitive.
public VariableReference appendClassPrimitive(Class<?> value) {
ClassPrimitiveStatement stmt = new ClassPrimitiveStatement(tc, value);
tc.addStatement(stmt);
return stmt.getReturnValue();
}
use of org.evosuite.testcase.statements.ClassPrimitiveStatement in project evosuite by EvoSuite.
the class EvoTestCaseCodeGenerator method createPlainInitStmt.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void createPlainInitStmt(CaptureLog log, int logRecNo) {
// NOTE: PLAIN INIT: has always one non-null param
// TODO: use primitives
final int oid = log.objectIds.get(logRecNo);
if (this.oidToVarRefMap.containsKey(oid)) {
// TODO this might happen because of Integer.valueOf(), for example. . Is this approach ok?
return;
}
final String type = log.getTypeName(oid);
final Object value = log.params.get(logRecNo)[0];
final VariableReference varRef;
if (value instanceof Class) {
// final PrimitiveStatement cps = ClassPrimitiveStatement.getPrimitiveStatement(testCase, getClassForName(type));
final PrimitiveStatement cps = new ClassPrimitiveStatement(testCase, getClassForName(type));
cps.setValue(value);
varRef = testCase.addStatement(cps);
} else {
final PrimitiveStatement primitiveValue = PrimitiveStatement.getPrimitiveStatement(testCase, getClassForName(type));
primitiveValue.setValue(value);
varRef = testCase.addStatement(primitiveValue);
}
this.oidToVarRefMap.put(oid, varRef);
}
Aggregations