### Question:
ClusterStateCollector { public ImmutableMap<String, Long> collectWrongEpochs() { Map<String, Long> wrongEpochs = new HashMap<>(); clusterState.forEach((server, state) -> { try { state.get(); } catch (Exception e) { if (e.getCause() instanceof WrongEpochException) { wrongEpochs.put(server, ((WrongEpochException) e.getCause()).getCorrectEpoch()); } } }); return ImmutableMap.copyOf(wrongEpochs); }  ClusterState collectClusterState(
            long epoch, ImmutableList<String> unresponsiveNodes,
            SequencerMetrics sequencerMetrics); ImmutableMap<String, Long> collectWrongEpochs();  }### Answer:
@Test public void testWrongEpochs() { final String localEndpoint = "a"; Map<String, CompletableFuture<NodeState>> clusterConnectivity = new HashMap<>(); final int newEpoch = 10; CompletableFuture<NodeState> wrongEpochCf = new CompletableFuture<>(); wrongEpochCf.completeExceptionally(new WrongEpochException(newEpoch)); CompletableFuture<NodeState> nodeAState = CompletableFuture.completedFuture( NodeState.builder().build() ); clusterConnectivity.put("a", nodeAState); clusterConnectivity.put("c", wrongEpochCf); ClusterStateCollector collector = ClusterStateCollector.builder() .localEndpoint(localEndpoint) .clusterState(clusterConnectivity) .build(); ImmutableMap<String, Long> wrongEpochs = collector.collectWrongEpochs(); assertThat(wrongEpochs.size()).isOne(); assertThat(wrongEpochs.get("c")).isEqualTo(newEpoch); }