### Question:
ThriftDcKeyBalancer extends ThriftDcBalancer<I, C> { public Optional<Stream<NodeStatus<I, C>>> getQuorumByKeyRecovery(K key) { BalancerConsistentHash<K, NodeStatus<I, C>> recovery = (BalancerConsistentHash<K, NodeStatus<I, C>>) getBalancerRecovery(); NodeStatus<I, C>[] array = recovery.getQuorum(key).toArray(NodeStatus[]::new); boolean shouldTest = false; boolean available = true; for (NodeStatus<I, C> status : array) { if (status.shouldSendTestRequest()) { shouldTest = true; } else if (!status.isInRing()) { available = false; } } if (shouldTest && available) { return Optional.of(Stream.of(array)); } else { return Optional.empty(); } } protected  ThriftDcKeyBalancer(
            String serviceName,
            String dcName,
            ThriftKeyBalancerConfig config,
            ToLongFunction<K> keyMapper
    ); Optional<NodeStatus<I, C>> getByKey(K key); Optional<NodeStatus<I, C>> getByKeyRecovery(K key); Stream<NodeStatus<I, C>> getQuorumByKey(K key); Optional<Stream<NodeStatus<I, C>>> getQuorumByKeyRecovery(K key);  }### Answer:
@Test(groups = "unit") public void getQuorumByKeyRecovery() throws Exception { when(node1.shouldSendTestRequest()).thenReturn(true); when(node2.shouldSendTestRequest()).thenReturn(false); when(node2.isInRing()).thenReturn(false); when(node2.isInRing()).thenReturn(true); assertTrue(balancer.getQuorumByKeyRecovery("key1").isPresent()); when(node1.shouldSendTestRequest()).thenReturn(false); assertFalse(balancer.getQuorumByKeyRecovery("key1").isPresent()); when(node1.isInRing()).thenReturn(true); assertFalse(balancer.getQuorumByKeyRecovery("key1").isPresent()); }