@Test
public void testSetOpenCircuitsToHalfOpen(TestContext context){

    Async async = context.async();
    context.assertFalse(jedis.exists(STORAGE_ALL_CIRCUITS));
    context.assertFalse(jedis.exists(STORAGE_HALFOPEN_CIRCUITS));
    context.assertFalse(jedis.exists(STORAGE_OPEN_CIRCUITS));
    String h1 = "hash_1";
    String h2 = "hash_2";
    String h3 = "hash_3";
    String h4 = "hash_4";
    String h5 = "hash_5";
    buildCircuitEntry(h1, HALF_OPEN);
    buildCircuitEntry(h2, OPEN);
    buildCircuitEntry(h3, OPEN);
    buildCircuitEntry(h4, OPEN);
    buildCircuitEntry(h5, HALF_OPEN);
    context.assertEquals(5L, jedis.scard(STORAGE_ALL_CIRCUITS));
    context.assertEquals(2L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS));
    context.assertEquals(3L, jedis.scard(STORAGE_OPEN_CIRCUITS));
    assertHashInHalfOpenCircuitsSet(context, h1, 2);
    assertHashInHalfOpenCircuitsSet(context, h5, 2);
    assertHashInOpenCircuitsSet(context, h2, 3);
    assertHashInOpenCircuitsSet(context, h3, 3);
    assertHashInOpenCircuitsSet(context, h4, 3);
    assertState(context, h1, HALF_OPEN);
    assertState(context, h2, OPEN);
    assertState(context, h3, OPEN);
    assertState(context, h4, OPEN);
    assertState(context, h5, HALF_OPEN);
    storage.setOpenCircuitsToHalfOpen().setHandler(event -> {
        context.assertTrue(event.succeeded());
        context.assertEquals(5L, jedis.scard(STORAGE_ALL_CIRCUITS));
        context.assertEquals(5L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS));
        context.assertEquals(0L, jedis.scard(STORAGE_OPEN_CIRCUITS));
        assertHashInHalfOpenCircuitsSet(context, h1, 5);
        assertHashInHalfOpenCircuitsSet(context, h2, 5);
        assertHashInHalfOpenCircuitsSet(context, h3, 5);
        assertHashInHalfOpenCircuitsSet(context, h4, 5);
        assertHashInHalfOpenCircuitsSet(context, h5, 5);
        assertState(context, h1, HALF_OPEN);
        assertState(context, h2, HALF_OPEN);
        assertState(context, h3, HALF_OPEN);
        assertState(context, h4, HALF_OPEN);
        assertState(context, h5, HALF_OPEN);
        async.complete();
    });
}