ZooKeeperManager { public void registerWatchAllFileSets() throws ZooKeeperClient.ZooKeeperConnectionException, KeeperException, InterruptedException { this.fileSetInfoMap = ZooKeeperMap.create( this.zkClient, this.clusterPath, BYTES_TO_FILE_SET_INFO); this.viewInfoMap = ZooKeeperMap.create( this.zkClient, this.clusterViewsPath, BYTES_TO_VIEW_INFO); } ZooKeeperManager(ZooKeeperClient zkClient, String clusterName); void createClusterPaths(); void registerWatchAllFileSets(); void lockFileSet(String fileSet,
                          FileSetInfo fileSetInfo,
                          CreateMode mode); void lockFileSet(String fileSet,
                          FileSetInfo fileSetInfo); void unlockFileSet(String fileSet); void setFileSetInfo(String fileSet,
                             FileSetInfo fileSetInfo); void deleteFileSetInfo(String fileSet); FileSetInfo getFileSetInfo(String fileSet); ViewInfo getViewInfo(String resource); void setViewInfo(ViewInfo viewInfo); void deleteViewInfo(String resource); FileSetInfo getFileSetInfoForced(String fileSet); FileSetInfo getLockedFileSetInfo(String fileSet); Map<String, Pair<FileSetInfo, FileSetInfo>> getCandidateHdfsDirMap(); InetSocketAddress getControllerLeader(); ClusterInfo getClusterInfo(); void setClusterInfo(ClusterInfo info); Map<String, FileSetInfo> getFileSetInfoMap(); List<String> getLockedFileSets(); List<String> getLiveInstances();  }
@Test @PrepareForTest(ZooKeeperMap.class) public void testRegisterWatchAllFileSets() throws Exception { PowerMockito.mockStatic(ZooKeeperMap.class); when(ZooKeeperMap.create(any(ZooKeeperClient.class), anyString(), any(Function.class))) .thenReturn(null); ArgumentCaptor<String> pathCaptor = ArgumentCaptor.forClass(String.class); zkManager.registerWatchAllFileSets(); verifyStatic(times(2)); ZooKeeperMap.create(any(ZooKeeperClient.class), pathCaptor.capture(), any(Function.class)); Set<String> allPaths = Sets.newHashSet(pathCaptor.getAllValues()); assertTrue(allPaths.contains(FILE_SET_DIR)); assertTrue(allPaths.contains(VIEWS_DIR)); }