@Test(expected = IllegalArgumentException.class) public void testWithLongString() throws Exception { converter.fromString("ab"); }
@Override public Character fromString(String input) throws IllegalArgumentException { if (input == null) { throw new NullPointerException("input must not be null"); } if (input.length() != 1) { throw new IllegalArgumentException("The input string \"" + input + "\" cannot be converted to a " + "character. The input's length must be 1"); } return input.toCharArray()[0]; }
CharacterConverter implements ParameterConverter<Character> { @Override public Character fromString(String input) throws IllegalArgumentException { if (input == null) { throw new NullPointerException("input must not be null"); } if (input.length() != 1) { throw new IllegalArgumentException("The input string \"" + input + "\" cannot be converted to a " + "character. The input's length must be 1"); } return input.toCharArray()[0]; } }
CharacterConverter implements ParameterConverter<Character> { @Override public Character fromString(String input) throws IllegalArgumentException { if (input == null) { throw new NullPointerException("input must not be null"); } if (input.length() != 1) { throw new IllegalArgumentException("The input string \"" + input + "\" cannot be converted to a " + "character. The input's length must be 1"); } return input.toCharArray()[0]; } private  CharacterConverter(); }
CharacterConverter implements ParameterConverter<Character> { @Override public Character fromString(String input) throws IllegalArgumentException { if (input == null) { throw new NullPointerException("input must not be null"); } if (input.length() != 1) { throw new IllegalArgumentException("The input string \"" + input + "\" cannot be converted to a " + "character. The input's length must be 1"); } return input.toCharArray()[0]; } private  CharacterConverter(); @Override Character fromString(String input); @Override Class<Character> getType(); }
CharacterConverter implements ParameterConverter<Character> { @Override public Character fromString(String input) throws IllegalArgumentException { if (input == null) { throw new NullPointerException("input must not be null"); } if (input.length() != 1) { throw new IllegalArgumentException("The input string \"" + input + "\" cannot be converted to a " + "character. The input's length must be 1"); } return input.toCharArray()[0]; } private  CharacterConverter(); @Override Character fromString(String input); @Override Class<Character> getType(); static final CharacterConverter INSTANCE; }