@Test public void shouldBeAbleToConvertNumbers() { assertThat(converter.convert("2", Short.class, bundle), is(equalTo((short) 2))); }
public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return Short.valueOf(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }
ShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return Short.valueOf(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } } }
ShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return Short.valueOf(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  }
ShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return Short.valueOf(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  Short convert(String value, Class<? extends Short> type, ResourceBundle bundle); }
ShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } try { return Short.valueOf(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  Short convert(String value, Class<? extends Short> type, ResourceBundle bundle);  }