assertEquals("Number of lines between input and output do not match", numberOfInputRows,
numberOfSuccessRows + numberOfErrorRows + numberOfOffsetRows);
}
// Initializations of row results
Row firstInputOffsetAdjustedRow = new Row();
Row lastInputRow = new Row();
Row firstSuccessRow = new Row();
Row lastSuccessRow = new Row();
Row firstErrorRow = new Row();
Row lastErrorRow = new Row();
// The next few if statements deal with the edge statements on file size...(i.e. suppose that there are no
// errors)
if (numberOfSuccessRows > 0) {
getFirstRow(firstSuccessRow, successFileReader, true, 0);
getLastRow(lastSuccessRow, successFileReader, true);
}
if (numberOfErrorRows > 0) {
getFirstRow(firstErrorRow, errorFileReader, false, 0);
getLastRow(lastErrorRow, errorFileReader, false);
}
if (numberOfInputRows > 0) {
final CSVFileReader inputFileReader = openConfiguredPath(cfg, Config.DAO_NAME);
getFirstRow(firstInputOffsetAdjustedRow, inputFileReader, false, numberOfOffsetRows);
getLastRow(lastInputRow, inputFileReader, false);
}
// Requirement I: First offset-adjusted row of input matches to either the error or success file's first row
if (numberOfSuccessRows > 0 || numberOfErrorRows > 0) {
assertTrue(firstInputOffsetAdjustedRow.get("NAME").equals(firstSuccessRow.get("NAME"))
|| firstInputOffsetAdjustedRow.get("NAME").equals(firstErrorRow.get("NAME")));
// Requirement II: Last input row matches to either the error or success file's last row
assertTrue(lastInputRow.get("NAME").equals(lastSuccessRow.get("NAME"))
|| lastInputRow.get("NAME").equals(lastErrorRow.get("NAME")));
} //otherwise vacuously true
}