@Test public void shouldComplainAboutInvalidNumber() { try { converter.convert("---", BigDecimal.class, bundle); } catch (ConversionError e) { assertThat(e.getMessage(), is(equalTo("--- is not a valid number."))); } }
public BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return new BigDecimal(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }
BigDecimalConverter implements Converter<BigDecimal> { public BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return new BigDecimal(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } } }
BigDecimalConverter implements Converter<BigDecimal> { public BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return new BigDecimal(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  }
BigDecimalConverter implements Converter<BigDecimal> { public BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return new BigDecimal(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle); }
BigDecimalConverter implements Converter<BigDecimal> { public BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return new BigDecimal(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_number"), value)); } }  BigDecimal convert(String value, Class<? extends BigDecimal> type, ResourceBundle bundle);  }