use of org.evosuite.assertion.PrimitiveFieldAssertion in project evosuite by EvoSuite.
the class DefaultTestCase method assertionsNeedDownCast.
private boolean assertionsNeedDownCast(Statement s, VariableReference var, Class<?> abstractClass) {
for (Assertion assertion : s.getAssertions()) {
if (assertion instanceof InspectorAssertion && assertion.getSource().equals(var)) {
InspectorAssertion inspectorAssertion = (InspectorAssertion) assertion;
Method inspectorMethod = inspectorAssertion.getInspector().getMethod();
if (!ClassUtils.hasMethod(abstractClass, inspectorMethod.getName(), inspectorMethod.getParameterTypes())) {
return true;
}
} else if (assertion instanceof PrimitiveFieldAssertion && assertion.getSource().equals(var)) {
PrimitiveFieldAssertion fieldAssertion = (PrimitiveFieldAssertion) assertion;
if (!fieldAssertion.getField().getDeclaringClass().isAssignableFrom(abstractClass)) {
return true;
}
}
}
return false;
}
Aggregations