GelfMessageLevelConverter implements Converter<GelfMessageLevel> { @Override public String convertTo(GelfMessageLevel value) { if (value == null) { throw new ParameterException("Couldn't convert \"null\" to string."); } return value.name(); }  @Override GelfMessageLevel convertFrom(String value); @Override String convertTo(GelfMessageLevel value);  }
@Test public void convertTo() throws Exception { assertEquals("WARNING", new GelfMessageLevelConverter().convertTo(GelfMessageLevel.WARNING)); }
@Test public void convertToWithNull() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert \"null\" to string."); new GelfMessageLevelConverter().convertTo(null); }