protected void runTheRestClosureWithError() {
        for (long i = Math.max(this.currentIndex, this.firstClosureIndex); i <= this.committedIndex; i++) {
            final Closure done = this.closures.get((int) (i - this.firstClosureIndex));
            if (done != null) {
                Requires.requireNonNull(this.error, "error");
                Requires.requireNonNull(this.error.getStatus(), "error.status");
                final Status status = this.error.getStatus();
                ThreadPoolsFactory.runClosureInThread(this.fsmCaller.getNode().getGroupId(), done, status);
            }
        }
    }
@Test
    public void testRunTheRestClosureWithError() throws Exception {
        testSetErrorAndRollback();
        for (final Closure closure : this.closures) {
            final MockClosure mc = (MockClosure) closure;
            assertNull(mc.s);
        }

        this.iter.runTheRestClosureWithError();
        Thread.sleep(500);
        int i = 0;
        for (final Closure closure : this.closures) {
            i++;
            final MockClosure mc = (MockClosure) closure;
            if (i < 7) {
                assertNull(mc.s);
            } else {
                final Status s = mc.s;
                Assert.assertEquals(RaftError.ESTATEMACHINE.getNumber(), s.getCode());
                assertEquals(
                    "StateMachine meet critical error when applying one or more tasks since index=6, Status[UNKNOWN<-1>: test]",
                    s.getErrorMsg());
            }
        }
    }