@Test public void shouldConvertToZeroWhenNull() { assertThat(converter.convert(null, short.class, bundle), is(equalTo((short) 0))); }
public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return (short) 0; } try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }
PrimitiveShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return (short) 0; } try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } } }
PrimitiveShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return (short) 0; } try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  }
PrimitiveShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return (short) 0; } try { return Short.parseShort(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); }
PrimitiveShortConverter implements Converter<Short> { public Short convert(String value, Class<? extends Short> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return (short) 0; } try { return Short.parseShort(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);  }