https://kotlinlang.org logo
#strikt
Title
# strikt
c

christophsturm

04/08/2021, 3:39 PM
are there matchers for bigdecimal?
to compare just the value and ignoring the formatting (1.0 == 1.00)
r

robfletcher

04/08/2021, 4:47 PM
Is that how BigDecimal equality works?
There’s nothing specific right now but I would have thought
isEqualTo
would be sufficient
c

christophsturm

04/08/2021, 7:08 PM
bigdecimal is only equal if the format is also equal. (so 1.0 != 1.00)
which probably means you should wrap it and provide equals yourself
r

robfletcher

04/08/2021, 8:01 PM
yeah, or there should be a clearly named assertion that isn’t just
isEqualTo
c

christophsturm

04/08/2021, 8:42 PM
isEqualToByValue or hasSameValueAs
7 Views