use of org.evosuite.testcase.statements.PrimitiveStatement in project evosuite by EvoSuite.
the class LegacyInsertion method selectRandomVariableForCall.
private VariableReference selectRandomVariableForCall(TestCase test, int position) {
if (test.isEmpty() || position == 0)
return null;
List<VariableReference> allVariables = test.getObjects(position);
Set<VariableReference> candidateVariables = new LinkedHashSet<VariableReference>();
for (VariableReference var : allVariables) {
if (!(var instanceof NullReference) && !var.isVoid() && !(test.getStatement(var.getStPosition()) instanceof PrimitiveStatement) && !var.isPrimitive())
candidateVariables.add(var);
}
if (candidateVariables.isEmpty()) {
return null;
} else {
VariableReference choice = Randomness.choice(candidateVariables);
return choice;
}
}
Aggregations