ParseUtil { public static double doubleValueOf(String value) { return doubleValueOf(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 testDoubleValueOf_whenLocaleIsJapan_thenRegardsDotAsRadixPoint() throws Exception { assertEquals(1.250, ParseUtil.doubleValueOf("1.250", Locale.JAPAN), 0.0); }
@Test public void testDoubleValueOf_whenLocaleIsEnglish_thenRegardsDotAsRadixPoint() throws Exception { assertEquals(1.250, ParseUtil.doubleValueOf("1.250", Locale.ENGLISH), 0.0); }
@Test public void testDoubleValueOf_whenLocaleIsFrance_thenRegardsCommaAsRadixPoint() throws Exception { assertEquals(1.250, ParseUtil.doubleValueOf("1,250", Locale.FRANCE), 0.0); }
@Test public void testDoubleValueOf_whenLocaleIsJapan_thenRegardsCommaAsSeparator() throws Exception { assertEquals(1_250, ParseUtil.doubleValueOf("1,250", Locale.JAPAN), 0.0); }
@Test(expected = NumberFormatException.class) public void testDoubleValueOf_whenStringIsNotNumber_thenThrowsException() throws Exception { ParseUtil.doubleValueOf("foobar"); }