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