LoggingLevelConverter implements Converter<Slf4jReporter.LoggingLevel> { @Override public Slf4jReporter.LoggingLevel convertFrom(String value) { try { return Slf4jReporter.LoggingLevel.valueOf(Strings.nullToEmpty(value).toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { throw new ParameterException("Couldn't convert value \"" + value + "\" to log level.", e); } }  @Override Slf4jReporter.LoggingLevel convertFrom(String value); @Override String convertTo(Slf4jReporter.LoggingLevel value);  }
@Test public void convertFromValidString() throws Exception { assertEquals(Slf4jReporter.LoggingLevel.INFO, new LoggingLevelConverter().convertFrom("INFO")); }
@Test public void convertFromValidLowerCaseString() throws Exception { assertEquals(Slf4jReporter.LoggingLevel.WARN, new LoggingLevelConverter().convertFrom("warn")); }
@Test public void convertFromInvalidString() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert value \"Foobar\" to log level."); new LoggingLevelConverter().convertFrom("Foobar"); }
@Test public void convertFromNull() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert value \"null\" to log level."); new LoggingLevelConverter().convertFrom(null); }