ParseUtil { public static BigDecimal bigDecimalValueOf(String value) throws NumberFormatException { return bigDecimalValueOf(value, Locale.getDefault()); } private  ParseUtil(); static double doubleValueOf(String value); static double doubleValueOf(String value, Locale locale); static BigDecimal bigDecimalValueOf(String value); static BigDecimal bigDecimalValueOf(String value, Locale locale);  }
@Test public void testBigDecimalValueOf_whenLocaleIsJapan_thenRegardsDotAsRadixPoint() throws Exception { assertEquals(new BigDecimal("1.234"), ParseUtil.bigDecimalValueOf("1.234", Locale.JAPAN)); }
@Test public void testBigDecimalValueOf_whenLocaleIsEnglish_thenRegardsDotAsRadixPoint() throws Exception { assertEquals(new BigDecimal("1.234"), ParseUtil.bigDecimalValueOf("1.234", Locale.ENGLISH)); }
@Test public void testBigDecimalValueOf_whenLocaleIsFrance_thenRegardsCommaAsRadixPoint() throws Exception { assertEquals(new BigDecimal("1.234"), ParseUtil.bigDecimalValueOf("1,234", Locale.FRANCE)); }
@Test public void testBigDecimalValueOf_whenLocaleIsJapan_thenRegardsCommaAsSeparator() throws Exception { assertEquals(new BigDecimal(1_234), ParseUtil.bigDecimalValueOf("1,234", Locale.JAPAN)); }
@Test(expected = NumberFormatException.class) public void testBigDecimalValueOf_whenStringIsNotNumber_thenThrowsException() throws Exception { ParseUtil.bigDecimalValueOf("foobar"); }