### Question:
KiteURIHandler implements URIHandler { @Override public void validate(final String uri) throws URIHandlerException { try { URI uriParsed = URI.create(uri); String scheme = uriParsed.getScheme(); if(!(URIBuilder.VIEW_SCHEME.equals(scheme) || URIBuilder.DATASET_SCHEME.equals(scheme))) { LOG.error("Unexpected scheme: view, uri was "+ uri); XException xException = new XException(ErrorCode.E0904, scheme, uri); throw new URIHandlerException(xException); } } catch (IllegalArgumentException iae) { XException xException = new XException(ErrorCode.E0906, iae); throw new URIHandlerException(xException); } }  @Override void init(final Configuration conf); @Override Set<String> getSupportedSchemes(); @Override Class<? extends LauncherURIHandler> getLauncherURIHandlerClass(); @Override List<Class<?>> getClassesForLauncher(); @Override DependencyType getDependencyType(final URI uri); @Override void registerForNotification(final URI uri, final Configuration conf,
      final String user, final String actionID); @Override boolean unregisterFromNotification(final URI uri, final String actionID); @Override Context getContext(final URI uri, final Configuration conf,
      final String user); @SuppressWarnings("rawtypes") @Override boolean exists(final URI uri, final Context context); @Override boolean exists(final URI uri, final Configuration conf, final String user); @Override String getURIWithDoneFlag(final String uri, final String doneFlag); @Override void validate(final String uri); @Override void destroy();  }### Answer:
@Test public void validateInvalidScheme() throws URIHandlerException { String uri = "repo:hdfs:/default/cloudera/users?favoriteColor=pink"; try { uriHandler.validate(uri); Assert.fail("Validate with an invalid schema should have thrown an exception"); } catch (XException ex) { Assert.assertEquals(ErrorCode.E0904, ex.getErrorCode()); } }
@Test public void validateNotAURI() throws URIHandlerException { String uri = "clearly not a uri"; try { uriHandler.validate(uri); Assert.fail("Validate with an invalid URI should have thrown an exception"); } catch (XException ex) { Assert.assertEquals(ErrorCode.E0906, ex.getErrorCode()); } }