LoggerConverter implements Converter<Logger> { @Override public Logger convertFrom(String value) { if (value == null) { throw new ParameterException("Couldn't convert value \"null\" to logger."); } return LoggerFactory.getLogger(value); }  @Override Logger convertFrom(String value); @Override String convertTo(Logger logger);  }
@Test public void convertFromValidString() throws Exception { assertEquals(LoggerFactory.getLogger("test"), new LoggerConverter().convertFrom("test")); }
@Test public void convertFromNull() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert value \"null\" to logger."); new LoggerConverter().convertFrom(null); }