i have problem with floating point assertions in SpringDBunit. I've read this question, but I am using MySql and cannot change DB layer. I've also checked dbunit documentation, but no luck with that either and still getting assertion error:
junit.framework.ComparisonFailure: value (table=tablename, row=0, col=colname)
Expected :0.35
Actual :0.35000000000000003
Is there any way how to set "tolerance" for assertion in SpringDBUnit?
My MySqlDataFactory looks as follows:
//MySqlDataTypeFactory is taken from a context
ToleratedDeltaMap.ToleratedDelta toleratedDelta = new ToleratedDeltaMap.ToleratedDelta("tablename","colname",0.001);
mySqlDataTypeFactory.addToleratedDelta(toleratedDelta);
And DatabaseConfigBean
is defined in context as follows:
<bean id="dbUnitDatabaseConfig" class="com.github.springtestdbunit.bean.DatabaseConfigBean">
<property name="datatypeFactory" value="#{testDataTypeFactory.getMySqlDataTypeFactory()}" />-
</bean>
Thanks in advance.