TextApplication { public void setUri(final String applicationUri) throws IllegalArgumentException { if (applicationUri == null) { uri = null; } else { final URI application; try { application = new URI(applicationUri); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } uri = application; } }  URI getUriObject(); int getPort(); void setPort(final int portNumber); String getUri(); void setUri(final String applicationUri);  }
@Test(expected = IllegalArgumentException.class) public void testSetUriInvalid() { final TextApplication application = new TextApplication(); application.setUri("#foo#"); }