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