更新时间:2022-01-01 09:27:37
这里是我最后做的由 DBUnit 完成):
Here's what I ended up doing (with the heavy lifting being done by DBUnit):
/**
* Compares the data in the two Excel files represented by the given input
* streams, closing them on completion
*
* @param expected can't be <code>null</code>
* @param actual can't be <code>null</code>
* @throws Exception
*/
private void compareExcelFiles(InputStream expected, InputStream actual)
throws Exception
{
try {
Assertion.assertEquals(new XlsDataSet(expected), new XlsDataSet(actual));
}
finally {
IOUtils.closeQuietly(expected);
IOUtils.closeQuietly(actual);
}
}
这将比较两个文件中的数据,可能不同的任何不相关元数据的假阴性的风险。希望这有助于某人。
This compares the data in the two files, with no risk of false negatives from any irrelevant metadata that might be different. Hope this helps someone.