### Question:
Initialize implements KeywordExecutable { static boolean checkInit(VolumeManager fs, SiteConfiguration sconf, Configuration hadoopConf) throws IOException { log.info("Hadoop Filesystem is {}", FileSystem.getDefaultUri(hadoopConf)); log.info("Accumulo data dirs are {}", Arrays.asList(VolumeConfiguration.getVolumeUris(sconf))); log.info("Zookeeper server is {}", sconf.get(Property.INSTANCE_ZK_HOST)); log.info("Checking if Zookeeper is available. If this hangs, then you need" + " to make sure zookeeper is running"); if (!zookeeperAvailable()) { log.error("FATAL Zookeeper needs to be up and running in order to init. Exiting ..."); return false; } if (sconf.get(Property.INSTANCE_SECRET).equals(Property.INSTANCE_SECRET.getDefaultValue())) { ConsoleReader c = getConsoleReader(); c.beep(); c.println(); c.println(); c.println("Warning!!! Your instance secret is still set to the default," + " this is not secure. We highly recommend you change it."); c.println(); c.println(); c.println("You can change the instance secret in accumulo by using:"); c.println(" bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName()); c.println("You will also need to edit your secret in your configuration" + " file by adding the property instance.secret to your" + " accumulo.properties. Without this accumulo will not operate" + " correctly"); } try { if (isInitialized(fs, sconf)) { printInitializeFailureMessages(sconf); return false; } } catch (IOException e) { throw new IOException("Failed to check if filesystem already initialized", e); } return true; }  boolean doInit(SiteConfiguration siteConfig, Opts opts, Configuration hadoopConf,
      VolumeManager fs); static void initSystemTablesConfig(ZooReaderWriter zoo, String zooKeeperRoot,
      Configuration hadoopConf); static boolean isInitialized(VolumeManager fs, SiteConfiguration siteConfig); @Override String keyword(); @Override UsageGroup usageGroup(); @Override String description(); @Override void execute(final String[] args); static void main(String[] args);  }### Answer:
@Test public void testCheckInit_NoZK() throws Exception { expect(zoo.exists("/")).andReturn(false); replay(sconf, zoo, fs); assertFalse(Initialize.checkInit(fs, sconf, conf)); }
@Test public void testCheckInit_AlreadyInit() throws Exception { expect(zoo.exists("/")).andReturn(true); expect(fs.exists(anyObject(Path.class))).andReturn(true); replay(sconf, zoo, fs); assertFalse(Initialize.checkInit(fs, sconf, conf)); }
@Test public void testCheckInit_FSException() throws Exception { expect(zoo.exists("/")).andReturn(true); expect(fs.exists(anyObject(Path.class))).andThrow(new IOException()); replay(sconf, zoo, fs); assertThrows(IOException.class, () -> Initialize.checkInit(fs, sconf, conf)); }
@Test public void testCheckInit_OK() throws Exception { expect(zoo.exists("/")).andReturn(true); expect(fs.exists(anyObject(Path.class))).andReturn(false).times(4); replay(sconf, zoo, fs); assertTrue(Initialize.checkInit(fs, sconf, conf)); }