@Test public void shouldNotComplainAboutNullAndEmpty() { assertThat(converter.convert(null, Character.class, bundle), is(nullValue())); assertThat(converter.convert("", Character.class, bundle), is(nullValue())); }
public Character convert(String value, Class<? extends Character> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } if (value.length() != 1) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_character"), value)); } return value.charAt(0); }
CharacterConverter implements Converter<Character> { public Character convert(String value, Class<? extends Character> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } if (value.length() != 1) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_character"), value)); } return value.charAt(0); } }
CharacterConverter implements Converter<Character> { public Character convert(String value, Class<? extends Character> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } if (value.length() != 1) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_character"), value)); } return value.charAt(0); }  }
CharacterConverter implements Converter<Character> { public Character convert(String value, Class<? extends Character> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } if (value.length() != 1) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_character"), value)); } return value.charAt(0); }  Character convert(String value, Class<? extends Character> type, ResourceBundle bundle); }
CharacterConverter implements Converter<Character> { public Character convert(String value, Class<? extends Character> type, ResourceBundle bundle) { if (isNullOrEmpty(value)) { return null; } if (value.length() != 1) { throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_character"), value)); } return value.charAt(0); }  Character convert(String value, Class<? extends Character> type, ResourceBundle bundle);  }