@Test
    public void testCircuit_TripAndExtend() throws InterruptedException {
        Circuit circuit = new Circuit(/*limit*/ 5, /*window*/ 1, /*reset*/ 2);
        Assert.assertFalse(circuit.isBroken());
        circuit.addFault();
        Assert.assertFalse(circuit.isBroken());
        circuit.addFault();
        circuit.addFault();
        circuit.addFault();
        Assert.assertFalse(circuit.isBroken());
        // On the 5th fault, the circuit will trip
        circuit.addFault();
        Assert.assertTrue(circuit.isBroken());
        
        // Cannot be reset yet
        Assert.assertFalse(circuit.isResettable());
        
        Thread.sleep(1000);

        // Still cannot be reset!
        Assert.assertFalse(circuit.isResettable());

        Thread.sleep(1000);
        // NOW it can be reset
        Assert.assertTrue(circuit.isResettable());
        
        Assert.assertFalse(circuit.isResetting());
        circuit.startReset();
        Assert.assertTrue(circuit.isResetting());
        Assert.assertFalse(circuit.isResettable());
        
        // During the reset, get another fault, which will re-trip the circuit
        Assert.assertTrue(circuit.isBroken());
        circuit.addFault();
        Assert.assertFalse(circuit.isResetting());
        Assert.assertFalse(circuit.isResettable());
        Assert.assertTrue(circuit.isBroken());
        
        // Cannot be reset yet (need to wait an additional 2s, not just 1s)
        Thread.sleep(1000);
        Assert.assertFalse(circuit.isResettable());
        
        // Should be OK after another 1s
        Thread.sleep(1001);
        Assert.assertTrue(circuit.isResettable());
        Assert.assertTrue(circuit.startReset());
        Assert.assertTrue(circuit.reset());
    }
Test method for {@link io.apiman.plugins.circuit_breaker.Circuit#reset()}.
plugins/circuit-breaker-policy/src/test/java/io/apiman/plugins/circuit_breaker/CircuitTest.java