Oops, didn't realize you had responded (didn't get an email notification or anything). I needed this while unit testing at my co. so just contributed it back. I was basically just providing ant wrapper support for a feature already present in the Assertion class. See Compare's execute method where if ignore columns are present it calls Assertion.assertEqualsIgnoreCols vs. assertEquals.
This was helpful for me, so thought I'd contribute it back. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Appreciate the contribution...
Would you mind explaining how to use it? I need to add doc for it too, explaining use.
You can add a doc page too, otherwise just reply with usage examples and I'll add it as a doc page.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
addIgnoreColumn is the new method. The presence of ignore columns on Compare results in Assertion.assertEqualsIgnoreCols being invoked rather than Assertion.assertEquals. In this example, I wanted to compare the data at the connection with the dataset while ignoring any columns named OPLK (as those are datetime columns that vary each run).
Equivalently, one should be able to supply an ignoredcolumn nested element to an ant compare task. So that is the only doc change needed I think (listing "ignorecolumn" as a nested element for compare with a single attribute, "name").
Since DefaultColumnFilter (implements IColumnFilter) already exsists, what do you think of changing your implementation to use it instead of your new class IgnoreColumn? Were you aware of those?
And I'm intrigued you use Compare instead of features of whatever idpDbTester is, assuming it is something like one of DBTestCase subclasses, e.g. DefaultPrepAndExpectedTestCase. They don't work for your situation?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Regarding Compare.addIgnoreColumn(...): what are your future plans with this? What calls this method?
Oops, didn't realize you had responded (didn't get an email notification or anything). I needed this while unit testing at my co. so just contributed it back. I was basically just providing ant wrapper support for a feature already present in the Assertion class. See Compare's execute method where if ignore columns are present it calls Assertion.assertEqualsIgnoreCols vs. assertEquals.
This was helpful for me, so thought I'd contribute it back. Thanks!
Appreciate the contribution...
Would you mind explaining how to use it? I need to add doc for it too, explaining use.
You can add a doc page too, otherwise just reply with usage examples and I'll add it as a doc page.
So in my case I ended up using the Ant POJOs in a JUnit test class:
protected void compareIdpDataToExpectedDataSet(String appName) throws DatabaseUnitException, Exception {
Compare compare = new Compare();
compare.setFormat("xml");
compare.setSrc(new File(testFilesPath + "/data-sets/idp-expected-" + appName + ".xml"));
compare.addIgnoreColumn(new IgnoreColumn("OPLK"));
compare.execute(idpDbTester.getConnection());
}
addIgnoreColumn is the new method. The presence of ignore columns on Compare results in Assertion.assertEqualsIgnoreCols being invoked rather than Assertion.assertEquals. In this example, I wanted to compare the data at the connection with the dataset while ignoring any columns named OPLK (as those are datetime columns that vary each run).
Equivalently, one should be able to supply an ignoredcolumn nested element to an ant compare task. So that is the only doc change needed I think (listing "ignorecolumn" as a nested element for compare with a single attribute, "name").
http://dbunit.sourceforge.net/anttask.html
Hope that helps!
Thanks,
Kyle
Thanks for the info.
Since DefaultColumnFilter (implements IColumnFilter) already exsists, what do you think of changing your implementation to use it instead of your new class IgnoreColumn? Were you aware of those?
And I'm intrigued you use Compare instead of features of whatever idpDbTester is, assuming it is something like one of DBTestCase subclasses, e.g. DefaultPrepAndExpectedTestCase. They don't work for your situation?