@Test
public void testReOpenCircuit(TestContext context){

    Async async = context.async();
    String circuitHash = "anotherCircuitHash";
    context.assertFalse(jedis.exists(STORAGE_ALL_CIRCUITS));
    context.assertFalse(jedis.exists(STORAGE_HALFOPEN_CIRCUITS));
    context.assertFalse(jedis.exists(STORAGE_OPEN_CIRCUITS));
    // prepare some test data
    writeQueueCircuitStateToDatabase(circuitHash, HALF_OPEN);
    writeQueueCircuitFailPercentageToDatabase(circuitHash, 50);
    addToCircuitsSets(HALF_OPEN, "a");
    addToCircuitsSets(HALF_OPEN, circuitHash);
    addToCircuitsSets(HALF_OPEN, "b");
    addToCircuitsSets(HALF_OPEN, "c");
    addToCircuitsSets(OPEN, "d");
    addToCircuitsSets(OPEN, "e");
    addToCircuitsSets(OPEN, "f");
    addToCircuitsSets(OPEN, "g");
    addToCircuitsSets(OPEN, "h");
    context.assertEquals(9L, jedis.scard(STORAGE_ALL_CIRCUITS));
    context.assertEquals(4L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS));
    context.assertEquals(5L, jedis.scard(STORAGE_OPEN_CIRCUITS));
    PatternAndCircuitHash patternAndCircuitHash = buildPatternAndCircuitHash("/anotherCircuit", circuitHash);
    storage.reOpenCircuit(patternAndCircuitHash).setHandler(event -> {
        context.assertTrue(event.succeeded());
        context.assertTrue(jedis.exists(STORAGE_ALL_CIRCUITS));
        context.assertTrue(jedis.exists(STORAGE_HALFOPEN_CIRCUITS));
        context.assertTrue(jedis.exists(STORAGE_OPEN_CIRCUITS));
        assertStateAndErroPercentage(context, circuitHash, OPEN, 50);
        context.assertEquals(3L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS));
        Set<String> halfOpenCircuits = jedis.smembers(STORAGE_HALFOPEN_CIRCUITS);
        context.assertTrue(halfOpenCircuits.contains("a"));
        context.assertTrue(halfOpenCircuits.contains("b"));
        context.assertTrue(halfOpenCircuits.contains("c"));
        context.assertFalse(halfOpenCircuits.contains(circuitHash));
        context.assertEquals(9L, jedis.scard(STORAGE_ALL_CIRCUITS));
        Set<String> allCircuits = jedis.smembers(STORAGE_ALL_CIRCUITS);
        context.assertTrue(allCircuits.contains("a"));
        context.assertTrue(allCircuits.contains("b"));
        context.assertTrue(allCircuits.contains("c"));
        context.assertTrue(allCircuits.contains("d"));
        context.assertTrue(allCircuits.contains("e"));
        context.assertTrue(allCircuits.contains("f"));
        context.assertTrue(allCircuits.contains("g"));
        context.assertTrue(allCircuits.contains("h"));
        context.assertTrue(allCircuits.contains(circuitHash));
        context.assertEquals(6L, jedis.scard(STORAGE_OPEN_CIRCUITS));
        Set<String> openCircuits = jedis.smembers(STORAGE_OPEN_CIRCUITS);
        context.assertTrue(openCircuits.contains("d"));
        context.assertTrue(openCircuits.contains("e"));
        context.assertTrue(openCircuits.contains("f"));
        context.assertTrue(openCircuits.contains("g"));
        context.assertTrue(openCircuits.contains("h"));
        context.assertTrue(openCircuits.contains(circuitHash));
        async.complete();
    });
}