@Test public void shouldBeAbleToConvertNull() { assertThat(converter.convert(null, Double.class, bundle), is(nullValue())); }
public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { final Locale locale = localization.getLocale(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); return fmt.parse(value).doubleValue(); } catch (ParseException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }
LocaleBasedDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { final Locale locale = localization.getLocale(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); return fmt.parse(value).doubleValue(); } catch (ParseException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } }
LocaleBasedDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { final Locale locale = localization.getLocale(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); return fmt.parse(value).doubleValue(); } catch (ParseException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } LocaleBasedDoubleConverter(Localization localization); }
LocaleBasedDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { final Locale locale = localization.getLocale(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); return fmt.parse(value).doubleValue(); } catch (ParseException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } LocaleBasedDoubleConverter(Localization localization); Double convert(String value, Class<? extends Double> type, ResourceBundle bundle); }
LocaleBasedDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { final Locale locale = localization.getLocale(); DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale); return fmt.parse(value).doubleValue(); } catch (ParseException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } LocaleBasedDoubleConverter(Localization localization); Double convert(String value, Class<? extends Double> type, ResourceBundle bundle);  }