if (col >= fieldNames.size())
return null; // ignore strange table geometry.
String fieldName = fieldNames.get(col);
String actualValue = queryResults.getCell(fieldName, matchedRow);
String expectedValue = table.getCellContents(col, tableRow);
SlimTestResult testResult;
if (fieldName.startsWith(COMMENT_COLUMN_MARKER))
testResult = SlimTestResult.plain();
else if (actualValue == null)
testResult = SlimTestResult.fail(String.format("field %s not present", fieldName), expectedValue);
else if (expectedValue == null || expectedValue.length() == 0)
testResult = SlimTestResult.ignore(actualValue);
else {
String symbolName = ifSymbolAssignment(expectedValue);
if (symbolName != null) {
setSymbol(symbolName, actualValue, true);
testResult = SlimTestResult.ignore(String.format("$%s<-[%s]", symbolName, actualValue));
} else {
testResult = matchMessage(actualValue, expectedValue);
if (testResult == null)
testResult = SlimTestResult.fail(actualValue, replaceSymbolsWithFullExpansion(expectedValue));
else if (testResult.getExecutionResult() == ExecutionResult.PASS)
testResult = markMatch(tableRow, matchedRow, col, testResult.getMessage());
}
}
table.updateContent(col, tableRow, testResult);
getTestContext().increment(testResult.getExecutionResult());
return testResult;
}