I am running assertions like so:
assertThat(obj.getTotal()).isEqualTo(BigDecimal.valueOf(4))
I am getting
Expecting: <4.00> to be equal to: <4>
so then I tried
assertThat(obj.getTotal()).isEqualTo(BigDecimal.valueOf(4.00))
Expecting: <4.00> to be equal to: <4.0>
I found a workaround in which I would set the scale of expected value 4
to 4.00
, but it seems quite irritating that I have to do so for all BigDecimal variables in my tests. Is there a better way from AssertJ that I am unaware of?
BigDecimal
has a weird definition of itsequal
method. – Dentifrice