@@ -0,0 +1,1222 @@
+package test.utils.concurrent;%0A%0Aimport com.firefly.utils.concurrent.IteratingCallback;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.Queue;%0A%0Aimport static org.hamcrest.Matchers.is;%0A%0A/**%0A * @author Pengtao Qiu%0A */%0Apublic class TestIteratingCallback %7B%0A%0A    @Test%0A    public void test() %7B%0A        int loop = 20;%0A        Queue%3CString%3E strings = new LinkedList%3C%3E();%0A        StringBuilder s = new StringBuilder(loop * 2);%0A        for (int i = 0; i %3C loop; i++) %7B%0A            strings.offer(%22e%22 + i);%0A            s.append(%22e%22).append(i);%0A        %7D%0A%0A        StringBuilder ret = new StringBuilder(loop * 2);%0A%0A        IteratingCallback callback = new IteratingCallback() %7B%0A%0A            @Override%0A            protected Action process() %7B%0A                String e = strings.poll();%0A                if (e != null) %7B%0A                    ret.append(e);%0A                    return Action.SCHEDULED;%0A                %7D else %7B%0A                    return Action.IDLE;%0A                %7D%0A            %7D%0A        %7D;%0A        callback.iterate();%0A        for (int i = 0; i %3C loop; i++) %7B%0A            callback.succeeded();%0A        %7D%0A%0A        Assert.assertThat(ret.toString(), is(s.toString()));%0A    %7D%0A%7D%0A

add test case for iterating callback