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:
parent
7e921762b6
commit
3f3adc726e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue