Search in sources :

Example 1 with ImmutableStringPrimitiveStatement

use of org.evosuite.testcase.statements.ImmutableStringPrimitiveStatement in project evosuite by EvoSuite.

the class EvoTestCaseCodeGenerator method createUnobservedInitStmt.

@SuppressWarnings({ "rawtypes" })
@Override
public void createUnobservedInitStmt(CaptureLog log, int logRecNo) {
    // NOTE: PLAIN INIT: has always one non-null param
    // TODO: use primitives
    final int oid = log.objectIds.get(logRecNo);
    try {
        final Object value = log.params.get(logRecNo)[0];
        final PrimitiveStatement stringRep = new ImmutableStringPrimitiveStatement(testCase, (String) value);
        final VariableReference stringRepRef = testCase.addStatement(stringRep);
        final MethodStatement m = new MethodStatement(testCase, new GenericMethod(EvoSuiteXStream.class.getMethod("fromString", new Class<?>[] { String.class }), EvoSuiteXStream.class), null, Arrays.asList(stringRepRef));
        this.oidToVarRefMap.put(oid, testCase.addStatement(m));
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : MethodStatement(org.evosuite.testcase.statements.MethodStatement) ClassPrimitiveStatement(org.evosuite.testcase.statements.ClassPrimitiveStatement) PrimitiveStatement(org.evosuite.testcase.statements.PrimitiveStatement) ImmutableStringPrimitiveStatement(org.evosuite.testcase.statements.ImmutableStringPrimitiveStatement) VariableReference(org.evosuite.testcase.variable.VariableReference) ImmutableStringPrimitiveStatement(org.evosuite.testcase.statements.ImmutableStringPrimitiveStatement) GenericMethod(org.evosuite.utils.generic.GenericMethod)

Aggregations

ClassPrimitiveStatement (org.evosuite.testcase.statements.ClassPrimitiveStatement)1 ImmutableStringPrimitiveStatement (org.evosuite.testcase.statements.ImmutableStringPrimitiveStatement)1 MethodStatement (org.evosuite.testcase.statements.MethodStatement)1 PrimitiveStatement (org.evosuite.testcase.statements.PrimitiveStatement)1 VariableReference (org.evosuite.testcase.variable.VariableReference)1 GenericMethod (org.evosuite.utils.generic.GenericMethod)1