MarkerConverter implements Converter<Marker> { @Override public String convertTo(Marker marker) { if (marker == null) { throw new ParameterException("Couldn't convert \"null\" to string."); } return marker.getName(); }  @Override Marker convertFrom(String value); @Override String convertTo(Marker marker);  }
@Test public void convertTo() throws Exception { assertEquals("test", new MarkerConverter().convertTo(MarkerFactory.getMarker("test"))); }
@Test public void convertToWithNull() throws Exception { expectedException.expect(ParameterException.class); expectedException.expectMessage("Couldn't convert \"null\" to string."); new MarkerConverter().convertTo(null); }