### Question:
ThriftLoadBalancer implements Closeable, Balancer<NodeStatus<I, C>> { @Override public Optional<NodeStatus<I, C>> get() { Optional<NodeStatus<I, C>> optional = recoveryBalancer.get().flatMap(ThriftDcBalancer::getRecover); if (optional.isPresent()) { return optional; } return balancer.get().flatMap(ThriftDcBalancer::get); } protected  ThriftLoadBalancer(
            String serviceName,
            ThriftBalancerConfig config,
            ScheduledExecutorService reBalanceScheduler,
            ScheduledExecutorService reloadScheduler,
            NodesHolder<I, C> nodesHolder
    ); void reconfigure(ThriftBalancerConfig newConfig); @Override void reBalance(); void evict(); @Override Optional<NodeStatus<I, C>> get(); Optional<NodeStatus<I, C>> getWorking(); @Override Stream<NodeStatus<I, C>> nodes(); Stream<ThriftDcBalancer<I, C>> dcList(); double getLoad(); int getUsedConnections(); int getOpenConnections(); Stream<ThriftClientAddress> getFailedNodes(); long getFailedNodesCount(); @Override void close(); String getServiceName(); void scheduleConfigReload(
            ThriftBalancerConfig.UntypedBuilder<?> builder,
            Consumer<ThriftBalancerConfig> toReconfigure
    ); static final Duration CONFIG_RELOAD_PERIOD; }### Answer:
@Test(groups = "unit") public void get() throws Exception { balancer.reBalance(); assertEquals(balancer.get().get(), status1); }
@Test(groups = "unit") public void getRecover() throws Exception { NodeStatus<String, ThriftClient<String>> statusRecover = mock(NodeStatus.class); when(dc2.getRecover()).thenReturn(Optional.of(statusRecover)); boolean recoverFound = false; for (int i = 0; i < 100; i++) { NodeStatus<String, ThriftClient<String>> status = balancer.get().get(); if (status == statusRecover) { recoverFound = true; break; } else if (status != status1) { fail("Unexpected node returned"); } } assertTrue(recoverFound); }