StringToProgramConverter implements Converter<String, Program> { @Override public Program convert(String id) { if (StringUtils.isBlank(id)) { return null; } else if (ConversionUtil.onlyDigits(id)) { return service.getProgram(Integer.valueOf(id)); } else { return service.getProgramByUuid(id); } }  @Override Program convert(String id);  }
@Test public void testById() throws Exception { Program converted = converter.convert("15"); verify(service).getProgram(15); }
@Test public void testByUuid() throws Exception { Program converted = converter.convert(UUID); verify(service).getProgramByUuid(UUID); }