|
|
|
[
Permlink
| « Hide
]
Felipe Leme - 12/Apr/09 05:50 AM
BTW, I faced this problem while working in the Unitils example for the upcoming JUnit in Action 2nd edition book (http://manning.com/tahchiev/). It would be very nice if this patch is applied (or the problem fixed in some other way) soon, otherwise I will have to hack the examples to work around this issue.
Hi Felipe,
I found our original implementation of the expected data set not satisfactory, so I built a new one. Following improvements are added: * as you requested: if you add an empty table to the expected data set, the assertion will fail if the actual table is not empty * better dealing with different types of values: comparing 1.00 with 1 or comparing dates used to give problems this is fixed now * the comparison now also takes primary key columns into account: if you specify a pk value in the expected data set, this row will now be compared with the corresponding actual row with those primary key values. * better output. The best matching differences are search and the actual content of the tables is added. Example output: java.lang.AssertionError: Assertion failed. Differences found between the expected data set and actual database content. Found differences for table PUBLIC.TEST: Different row: pk, column1, column2 "1", "value1", "xxxx" Best matching differences: column2: "xxxx" <-> "value2" Actual database content: PUBLIC.TEST COLUMN1, COLUMN2 "value1", "value2" "value2", "value3" Other example output: java.lang.AssertionError: Assertion failed. Differences found between the expected data set and actual database content. Expected table to be empty but found rows for table PUBLIC.TEST Actual database content: PUBLIC.TEST COLUMN1, COLUMN2 "value1", "value2" "value2", "value3" Still todo: * make the date format configurable * add special values like current_date * create @NotExpectedDataSet Could you please take a look? Remarks and suggestions are very welcome. best regards, Tim |
||||||||||||||||||||||||||||||||||||||||||||||