Uri { public static boolean isValid(String s) { try { new URI(UriEncoder.encode(s)); } catch (URISyntaxException e) { return false; } return true; }  static boolean isValid(String s); static String escapeDisallowedChars(String s); static String resolve(String base, String uriReference); static boolean hasFragmentId(String uri); static boolean isAbsolute(String uri);  }
@Test(dataProvider = "invalid") public void testInvalid(String uri) { Assert.assertFalse(Uri.isValid(uri)); }
@Test(dataProvider = "valid") public void testValid(String uri) { Assert.assertTrue(Uri.isValid(uri)); }