Please override with the latest change (#10780)

* Code commit for "Converting String to BigDecimal in Java" - Article

* modified the assert param for comparing actual and expected values

* removed the conflict change
This commit is contained in:
Bhabani Prasad Patel 2021-05-19 08:34:43 +05:30 committed by GitHub
parent 7e921762b6
commit 3f3adc726e
1 changed files with 4 additions and 4 deletions

View File

@ -13,8 +13,8 @@ public class StringToBigDecimalConversionUnitTest {
@Test
public void givenValidString_WhenBigDecimalObjectWithStringParameter_ThenResultIsDecimalObject() {
BigDecimal bigDecimal = new BigDecimal(123);
assertEquals(bigDecimal, new BigDecimal("123"));
BigDecimal bigDecimal = new BigDecimal("123");
assertEquals(new BigDecimal(123), bigDecimal);
}
@Test(expected = NullPointerException.class)
@ -30,8 +30,8 @@ public class StringToBigDecimalConversionUnitTest {
@Test
public void givenValidString_WhenValueOfDoubleFromString_ThenResultIsDecimalObject() {
BigDecimal bigDecimal = new BigDecimal(123.42).setScale(2, BigDecimal.ROUND_HALF_UP);
assertEquals(bigDecimal, BigDecimal.valueOf(Double.valueOf("123.42")));
BigDecimal bigDecimal = BigDecimal.valueOf(Double.valueOf("123.42"));
assertEquals(new BigDecimal(123.42).setScale(2, BigDecimal.ROUND_HALF_UP), bigDecimal);
}
@Test(expected = NullPointerException.class)