compare - AssertJ comparing double values -
i compare double values assertj. dont catch why test failing.
@test public void testinteresttoquote() { double result = basiccalculator.accumulationfactorbyyearsandinterest(years, interest) assertions.assertthat(result).iscloseto(expected, assertions.offset(0.1d)) }
exception is:
java.lang.assertionerror: expecting: <7.256571590148141e-5> close to: <7.25> less <0.1> difference <7.249927434284099>. (a difference of <0.1> being considered valid)
why assertion fail?
it late yesterday, 7.256571590148141e-5 not thought, 7.25.., because e-5 moves point 5 left, 0.0000725...
Comments
Post a Comment