### Question:
HCatURIHandler implements URIHandler { @Override public boolean exists(URI uri, Context context) throws URIHandlerException { HCatClient client = ((HCatContext) context).getHCatClient(); return exists(uri, client, false); }  @Override void init(Configuration conf); @Override Set<String> getSupportedSchemes(); @Override Class<? extends LauncherURIHandler> getLauncherURIHandlerClass(); @Override List<Class<?>> getClassesForLauncher(); @Override DependencyType getDependencyType(URI uri); @Override void registerForNotification(URI uri, Configuration conf, String user, String actionID); @Override boolean unregisterFromNotification(URI uri, String actionID); @Override Context getContext(URI uri, Configuration conf, String user, boolean readOnly); @Override boolean exists(URI uri, Context context); @Override boolean exists(URI uri, Configuration conf, String user); @Override void delete(URI uri, Context context); @Override void delete(URI uri, Configuration conf, String user); @Override String getURIWithDoneFlag(String uri, String doneFlag); @Override String getURIWithoutDoneFlag(String uri, String doneFlag); @Override void validate(String uri); @Override void destroy();  }### Answer:
@Test public void testExists() throws Exception { setSystemProperty(XTestCase.TEST_USER1_PROP, System.getProperty("user.name")); createTestTable(); addPartition(db, table, "year=2012;month=12;dt=02;country=us"); URI hcatURI = getHCatURI(db, table, "country=us;year=2012;month=12;dt=02"); URIHandler handler = uriService.getURIHandler(hcatURI); assertTrue(handler.exists(hcatURI, conf, getTestUser())); hcatURI = getHCatURI(db, table, "year=2012;month=12"); assertTrue(handler.exists(hcatURI, conf, getTestUser())); addPartition(db, table, "year=2012;month=12;dt=03;country=us"); hcatURI = getHCatURI(db, table, "country=us;month=12"); assertTrue(handler.exists(hcatURI, conf, getTestUser())); hcatURI = getHCatURI(db, table, "country=us"); assertTrue(handler.exists(hcatURI, conf, getTestUser())); hcatURI = getHCatURI(db, table, "dt=02"); assertTrue(handler.exists(hcatURI, conf, getTestUser())); hcatURI = getHCatURI(db, table, "dt=05"); assertFalse(handler.exists(hcatURI, conf, getTestUser())); hcatURI = getHCatURI(db, table, "month=02;dt=02"); assertFalse(handler.exists(hcatURI, conf, getTestUser())); addPartition(db, table, "year=2012;month=12;dt=04;country=us"); hcatURI = getHCatURI(db, table, "country=us;year=2012;month=12;dt=04"); assertTrue(handler.exists(hcatURI, conf, getTestUser())); ((HCatURIHandler)handler).delete(hcatURI, conf, getTestUser()); assertFalse(handler.exists(hcatURI, conf, getTestUser())); dropTestTable(false); }