URIUtil { public static boolean isCorrectURISplit(String namespace, String localName) { assert namespace != null : "namespace must not be null"; assert localName != null : "localName must not be null"; if (namespace.length() == 0) { return false; } int nsLength = namespace.length(); char lastNsChar = namespace.charAt(nsLength - 1); if (lastNsChar == '#') { return namespace.lastIndexOf('#', nsLength - 2) == -1 && localName.indexOf('#') == -1; } else if (lastNsChar == '/') { return localName.indexOf('/') == -1 && localName.indexOf('#') == -1 && namespace.indexOf('#') == -1; } else if (lastNsChar == ':') { return localName.indexOf(':') == -1 && localName.indexOf('#') == -1 && localName.indexOf('/') == -1 && namespace.indexOf('#') == -1 && namespace.indexOf('/') == -1; } return false; }  static int getLocalNameIndex(String uri); static boolean isCorrectURISplit(String namespace, String localName); static boolean isValidURIReference(String uriRef);  }
@Test public void testIsCorrectURISplit() throws Exception { assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("http: assertTrue(URIUtil.isCorrectURISplit("isbn:", "")); assertTrue(URIUtil.isCorrectURISplit("isbn:", "1")); assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("http: assertFalse(URIUtil.isCorrectURISplit("isbn:", "1#2")); assertFalse(URIUtil.isCorrectURISplit("isbn:", "1/2")); assertFalse(URIUtil.isCorrectURISplit("isbn:", "1:2")); }