Reputation: 4076
junit.framework.ComparisonFailure:
value (table=XXX, row=XXX, col=XXX)
expected:<2013-01-18 18:17:13.233099>
but was:<2013-01-18 18:17:13.233099>
at org.dbunit.assertion.JUnitFailureFactory.createFailure(JUnitFailureFactory.java:39)...
my code:
...
IDataSet actualDataSet = conn.createDataSet();
XmlDataSet expectedDataSet = new XmlDataSet(getClass().getResourceAsStream("/data.xml"));
Assertion.assertEquals(expectedDataSet, actualDataSet);
...
conn - connection to database PostgreSql 7.1
What is wrong?
Upvotes: 0
Views: 1371
Reputation: 4076
org.dbunit.dataset.datatype.TimestampDataType.typeCast()
cast to Timestamp and then other class compare objects. I don't undestend why it's doesn't work.
To avoid this problem I excluded column:
String[] actualTablenames = actualDataSet.getTableNames();
for (int i = 0; i < actualTableNames.length; i++) {
ITable expectedTable = expectedDataSet.getTable(actualTableNames[i]);
...
ITable filteredActualTable = DefaultColumnFilter.excludedColumnsTable(actualTable, new String[]{"changetime"});
Upvotes: 0
Reputation: 83577
Hard to say without more information, but it looks like there may be a problem with the class that represents the value in "table=XXX, row=XXX, col=XXX". What datatype is that? Some "Date"-like class? Does it correctly implement equals()
?
A common problem with JUnit et al. is to use assertEquals
on types where equals()
does not compare by value - then comparison always yields false
. This looks like one of those cases.
Upvotes: 1