modified the assert param for comparing actual and expected values
@@ -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)
