### Question:
ZKRegistrationManager implements RegistrationManager { @Override public boolean prepareFormat() throws Exception { boolean ledgerRootExists = null != zk.exists(ledgersRootPath, false); boolean availableNodeExists = null != zk.exists(bookieRegistrationPath, false); if (!ledgerRootExists) { ZkUtils.createFullPathOptimistic(zk, ledgersRootPath, "".getBytes(StandardCharsets.UTF_8), zkAcls, CreateMode.PERSISTENT); } if (!availableNodeExists) { zk.create(bookieRegistrationPath, "".getBytes(StandardCharsets.UTF_8), zkAcls, CreateMode.PERSISTENT); } if (null == zk.exists(bookieReadonlyRegistrationPath, false)) { zk.create(bookieReadonlyRegistrationPath, new byte[0], zkAcls, CreateMode.PERSISTENT); } return ledgerRootExists; } ZKRegistrationManager(ServerConfiguration conf,
                                 ZooKeeper zk,
                                 RegistrationListener listener);  ZKRegistrationManager(ServerConfiguration conf,
                                 ZooKeeper zk,
                                 String ledgersRootPath,
                                 RegistrationListener listener); @Override void close(); String getCookiePath(BookieId bookieId); @Override void registerBookie(BookieId bookieId, boolean readOnly,
                               BookieServiceInfo bookieServiceInfo); @Override void unregisterBookie(BookieId bookieId, boolean readOnly); @Override void writeCookie(BookieId bookieId,
                            Versioned<byte[]> cookieData); @Override Versioned<byte[]> readCookie(BookieId bookieId); @Override void removeCookie(BookieId bookieId, Version version); @Override String getClusterInstanceId(); @Override boolean prepareFormat(); @Override boolean initNewCluster(); @Override boolean nukeExistingCluster(); @Override boolean format(); @Override boolean isBookieRegistered(BookieId bookieId);  }### Answer:
@Test public void testPrepareFormat () throws Exception { try { ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setMetadataServiceUri("zk+hierarchical: zkc = localZkServer.getZooKeeperClient(); ZKRegistrationManager zkRegistrationManager = new ZKRegistrationManager(conf, zkc, () -> {}); zkRegistrationManager.prepareFormat(); assertNotNull(zkc.exists("/test/ledgers", false)); } finally { if (zkc != null) { zkc.close(); } } }