StringToVisitConverter implements Converter<String, Visit> { @Override public Visit convert(String source) { if (StringUtils.isEmpty(source)) { return null; } return Context.getVisitService().getVisit(Integer.valueOf(source)); }  @Override Visit convert(String source);  }
@Test public void convert_shouldConvertString() { Assert.assertThat(converter.convert(null), nullValue()); Assert.assertThat(converter.convert(""), nullValue()); Assert.assertThat(converter.convert("1"), is(Context.getVisitService().getVisit(1))); }