### Question:
InMemClusterMetadataStore implements ClusterMetadataStore { @Override public synchronized void unwatchClusterAssignmentData(Consumer<Void> watcher) { watchers.remove(watcher); } InMemClusterMetadataStore(int numStorageContainers); @Override synchronized boolean initializeCluster(int numStorageContainers,
                                               Optional<String> segmentStorePath); @Override synchronized ClusterAssignmentData getClusterAssignmentData(); @Override synchronized void updateClusterAssignmentData(ClusterAssignmentData assignmentData); @Override synchronized void watchClusterAssignmentData(Consumer<Void> watcher, Executor executor); @Override synchronized void unwatchClusterAssignmentData(Consumer<Void> watcher); @Override synchronized ClusterMetadata getClusterMetadata(); @Override synchronized void updateClusterMetadata(ClusterMetadata clusterMetadata); @Override void close();  }### Answer:
@Test public void testUnwatchClusterAssignmentData() throws Exception { ClusterAssignmentData assignmentData = ClusterAssignmentData.newBuilder() .putServers( "server-0", ServerAssignmentData.newBuilder() .addContainers(1L) .addContainers(2L) .build()) .build(); @Cleanup("shutdown") ExecutorService executor = Executors.newSingleThreadExecutor(); CompletableFuture<Void> watchFuture = new CompletableFuture<>(); CountDownLatch latch = new CountDownLatch(2); Consumer<Void> dataConsumer = ignored -> { latch.countDown(); FutureUtils.complete(watchFuture, null); }; assertEquals(0, store.getNumWatchers()); store.watchClusterAssignmentData(dataConsumer, executor); assertEquals(1, store.getNumWatchers()); store.updateClusterAssignmentData(assignmentData); watchFuture.join(); assertEquals(1, latch.getCount()); assertEquals(assignmentData, store.getClusterAssignmentData()); store.unwatchClusterAssignmentData(dataConsumer); assertEquals(0, store.getNumWatchers()); store.updateClusterAssignmentData(assignmentData); watchFuture.get(100, TimeUnit.MILLISECONDS); assertEquals(1, latch.getCount()); }