### Question:
CharacterPropertyConverter extends AbstractPropertyConverter { @Override public Object convert(String value, Context context) { value = value.trim(); if (value.isEmpty() || value.length() > 1) { throw new IllegalArgumentException("requires a string of length 1"); } if (value.charAt(0) == '\\') { return ' '; } return value.charAt(0); }  @Override boolean supports(Class<?> type); @Override Object convert(String value, Context context);  }### Answer:
@Test public void testConvertStringOfLength1() throws Exception { assertThat((Character) converter.convert( STRING_OF_LENGTH_1, null), is(equalTo(STRING_OF_LENGTH_1.charAt(0)))); }
@Test public void testConvertStringWithWhitespace() throws Exception { assertThat((Character) converter.convert( STRING_WITH_WHITESPACE, null), is(equalTo(STRING_WITH_WHITESPACE.trim().charAt(0)))); }
@Test public void testConvertStringWithEscapedSpace() throws Exception { assertThat((Character) converter.convert( STRING_WITH_ESCAPED_SPACE, null), is(equalTo(' '))); }
@Test(expected = IllegalArgumentException.class) public void testConvertStringOfLengthGreaterThan1() throws Exception { converter.convert(STRING_OF_LENGTH_GT_1, null); }
@Test(expected = IllegalArgumentException.class) public void testConvertEmptyString() throws Exception { converter.convert(EMPTY_STRING, null); }