@Test public void shouldConvertToZeroWhenEmpty() { assertThat((Double) converter.convert("", double.class, bundle), is(equalTo(0D))); }
public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0d; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }
PrimitiveDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0d; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } }
PrimitiveDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0d; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  }
PrimitiveDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0d; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  Double convert(String value, Class<? extends Double> type, ResourceBundle bundle); }
PrimitiveDoubleConverter implements Converter<Double> { public Double convert(String value, Class<? extends Double> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0d; } try { return Double.parseDouble(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  Double convert(String value, Class<? extends Double> type, ResourceBundle bundle);  }