use of org.evosuite.testcase.FieldStatement in project evosuite by EvoSuite.
the class TestExtractingVisitor method retrieveVariableReference.
private VariableReference retrieveVariableReference(QualifiedName qualifiedName) {
try {
Class<?> referencedClass = retrieveTypeClass(qualifiedName.getQualifier().resolveTypeBinding());
Field field = referencedClass.getField(qualifiedName.getName().getIdentifier());
FieldReference fieldReference = new FieldReference(testCase.getReference(), new GenericField(field, referencedClass));
Class<?> resultClass = retrieveTypeClass(qualifiedName.resolveTypeBinding());
FieldStatement fieldStatement = new FieldStatement(testCase.getReference(), new GenericField(field, resultClass), fieldReference);
testCase.addStatement(fieldStatement);
return fieldStatement.getReturnValue();
} catch (Exception exc) {
throw new RuntimeException(exc);
}
}
Aggregations