StringToRoleConverter implements Converter<String, Role> { @Override public Role convert(String source) { if (StringUtils.isEmpty(source)) { return null; } return Context.getUserService().getRole(source); }  @Override Role convert(String source);  }
@Test public void convert_shouldConvertString() { Assert.assertNull(converter.convert(null)); Assert.assertNull(converter.convert("")); Assert.assertThat(converter.convert("Provider"), is(Context.getUserService().getRole("Provider"))); }