StringToURLConverter extends AbstractGenericConverter<String, URL> { @Override public URL convert(String source) { try { return new URL(source); } catch (MalformedURLException e) { throw new ConverterException(source, getTargetTypeToken().getRawType(), e); } }  @Override URL convert(String source);  }
@Test public void testConvert() { URL url = converter.convert("http: assertEquals("http", url.getProtocol()); assertEquals("www.google.com", url.getHost()); }
@Test(expected = ConverterException.class) public void testRaiseException() { converter.convert("&&##3"); }