StringToRelationshipConverter implements Converter<String, Relationship> { @Override public Relationship convert(String source) { if (StringUtils.isEmpty(source)) { return null; } return Context.getPersonService().getRelationship(Integer.valueOf(source)); }  @Override Relationship convert(String source);  }
@Test public void convert_shouldConvertString() { Assert.assertNull(converter.convert(null)); Assert.assertNull(converter.convert("")); Assert.assertThat(converter.convert("1"), is(Context.getPersonService().getRelationship(1))); }