### Question:
ThriftDcBalancer implements Balancer<NodeStatus<I, C>>, Closeable { public Optional<NodeStatus<I, C>> getRecover() { Optional<NodeStatus<I, C>> nodeOpt = balancerRecovery.get(); return nodeOpt.filter(NodeStatus::shouldSendTestRequest); } protected  ThriftDcBalancer(String serviceName, String dcName, ThriftBalancerConfig config); void setDcNodes(List<NodeStatus<I, C>> ring, int totalNodeCount); void doHealthCheck(); @Override void reBalance(); boolean isWorking(); boolean canProcessRequests(); @Override Optional<NodeStatus<I, C>> get(); Optional<NodeStatus<I, C>> getRecover(); @Override Stream<NodeStatus<I, C>> nodes(); String getDcName(); LoadBasedBalancer.LoadAccumulator<ThriftDcBalancer<I, C>> getLoadAccumulator(); double getLoad(); int getUsedConnections(); int getOpenConnections(); @Override void close(); long getFailNodesCount(); String getStatus(); void reconfigure(ThriftBalancerConfig config);  }### Answer:
@Test(groups = "unit", timeOut = 1000) public void getRecover() throws Exception { NodeStatus<String, ThriftClient<String>> result1 = balancer.getRecover().get(); when(result1.shouldSendTestRequest()).thenReturn(false); Optional<NodeStatus<String, ThriftClient<String>>> result2; while (!(result2 = balancer.getRecover()).isPresent()); when(result2.get().shouldSendTestRequest()).thenReturn(false); for (int i = 0; i < 20; i++) { assertFalse(balancer.getRecover().isPresent()); } assertEquals(new HashSet<>(Arrays.asList(result1, result2.get())), new HashSet<>(Arrays.asList(node1, node2))); }