FSRegistryOperationsService extends CompositeService implements RegistryOperations { @Override public boolean exists(String path) throws IOException { return fs.exists(makePath(path)); } FSRegistryOperationsService(); @VisibleForTesting FileSystem getFs(); @Override boolean mknode(String path, boolean createParents); @Override void bind(String path, ServiceRecord record, int flags); @Override ServiceRecord resolve(String path); @Override RegistryPathStatus stat(String path); @Override boolean exists(String path); @Override List<String> list(String path); @Override void delete(String path, boolean recursive); @Override boolean addWriteAccessor(String id, String pass); @Override void clearWriteAccessors();  }
@Test public void testExists() throws IOException { System.out.println("pre-create test path"); fs.mkdirs(new Path("test/registryTestNode")); System.out.println("Check for existing node"); boolean exists = registry.exists("test/registryTestNode"); Assert.assertTrue(exists); System.out.println("Check for non-existing node"); exists = registry.exists("test/nonExistentNode"); Assert.assertFalse(exists); }