Is there a way telling DB-Unit to ignore the order in which rows should be compared? My problem is, that I do not know in which order the rows will be written to the database, but DB-Unit forces me to give an ordered list.
What I want dbunit to do is:
Any ideas?
Solved this issue for me. I'm sorting the rows of the actual and expected tables. Therefore I use all columns which can be found in expected table. This approach might result in problems if the table you are checking is large but in my case it is not. :-)
Column[] expectedColumns = expectedTable.getTableMetaData().getColumns();
ITable sortedExpected = new SortedTable(expectedTable, expectedColumns);
ITable sortedActual = new SortedTable(actualTable, expectedColumns);
Assertion.assertEquals(sortedExpected, sortedActual);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With