@@ -0,0 +1,1810 @@
+package com.github.phantomthief.failover.impl;%0A%0Aimport static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;%0Aimport static java.util.concurrent.TimeUnit.MILLISECONDS;%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0Aimport static org.junit.jupiter.api.Assertions.assertTrue;%0A%0Aimport java.util.function.Predicate;%0A%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport com.google.common.collect.HashMultiset;%0Aimport com.google.common.collect.ImmutableList;%0Aimport com.google.common.collect.Multiset;%0A%0A/**%0A * @author w.vela%0A * Created on 2019-01-04.%0A */%0Aclass RecoverableCheckFailoverTest %7B%0A%0A    @Test%0A    void test() %7B%0A        boolean%5B%5D checkerSwitcher = %7B false %7D;%0A        Predicate%3CString%3E checker = it -%3E checkerSwitcher%5B0%5D;%0A        RecoverableCheckFailover%3CString%3E failover = RecoverableCheckFailover%0A                .%3CString%3E newGenericBuilder().setChecker(checker) // %0A                .setFailCount(10) //%0A                .setFailDuration(100, MILLISECONDS) //%0A                .setRecoveryCheckDuration(100, MILLISECONDS) //%0A                .setReturnOriginalWhileAllFailed(false) //%0A                .build(ImmutableList.of(%22s1%22, %22s2%22));%0A        for (int i = 0; i %3C 10; i++) %7B%0A            failover.fail(%22s2%22);%0A        %7D%0A        for (int i = 0; i %3C 10; i++) %7B%0A            assertEquals(%22s1%22, failover.getOneAvailable());%0A        %7D%0A        checkerSwitcher%5B0%5D = true;%0A        sleepUninterruptibly(100, MILLISECONDS);%0A        Multiset%3CString%3E result = HashMultiset.create();%0A        for (int i = 0; i %3C 10000; i++) %7B%0A            result.add(failover.getOneAvailable());%0A        %7D%0A        assertTrue(between((double) result.count(%22s2%22) / result.count(%22s1%22), 0.8, 1.2));%0A    %7D%0A%0A    private boolean between(double k, double min, double max) %7B%0A        return min %3C= k && k %3C= max;%0A    %7D%0A%7D

add recoverable failover.