BAEL-1217 fixed failing tests

This commit is contained in:
Yasin Bhojawala 2017-10-29 19:16:42 +05:30
parent 9fee77a9d9
commit 729c392019
2 changed files with 2 additions and 3 deletions

View File

@ -32,8 +32,7 @@ public class GenericBigDecimalConverter implements GenericConverter {
} else {
Number number = (Number) source;
BigDecimal converted = new BigDecimal(number.doubleValue());
converted.setScale(2, BigDecimal.ROUND_HALF_EVEN);
return converted;
return converted.setScale(2, BigDecimal.ROUND_HALF_EVEN);
}
}
}

View File

@ -44,7 +44,7 @@ public class CustomConverterTest {
@Test
public void whenConvertingToBigDecimalUsingGenericConverter_thenSuccess() {
assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).
isEqualTo(BigDecimal.valueOf(11));
isEqualTo(BigDecimal.valueOf(11.00).setScale(2, BigDecimal.ROUND_HALF_EVEN));
assertThat(conversionService.convert(Double.valueOf(25.23), BigDecimal.class))
.isEqualByComparingTo(BigDecimal.valueOf(Double.valueOf(25.23)));
assertThat(conversionService.convert("2.32", BigDecimal.class))