@Test public void shouldConvertToZeroWhenEmpty() { assertThat((Long) converter.convert("", long.class, bundle), is(equalTo(0L))); }
public Long convert(String value, Class<? extends Long> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0L; } try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }
PrimitiveLongConverter implements Converter<Long> { public Long convert(String value, Class<? extends Long> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0L; } try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } } }
PrimitiveLongConverter implements Converter<Long> { public Long convert(String value, Class<? extends Long> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0L; } try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  }
PrimitiveLongConverter implements Converter<Long> { public Long convert(String value, Class<? extends Long> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0L; } try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  Long convert(String value, Class<? extends Long> type, ResourceBundle bundle); }
PrimitiveLongConverter implements Converter<Long> { public Long convert(String value, Class<? extends Long> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return 0L; } try { return Long.parseLong(value); } catch (NumberFormatException e) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_integer"), value)); } }  Long convert(String value, Class<? extends Long> type, ResourceBundle bundle);  }