1 package org.apache.commons.javaflow.bytecode.transformation.tests; 2 3 import org.apache.commons.javaflow.Continuation; 4 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase; 5 import org.apache.commons.javaflow.bytecode.transformation.rewrite.CounterFlow; 6 7 public abstract class AbstractCounterTestCase extends AbstractTransformerTestCase { 8 9 public void testCounter() { 10 final int count = 5; 11 final Runnable r = new CounterFlow(count); 12 int i = 0; 13 Continuation c = Continuation.startWith(r); 14 while (c != null) { 15 c = Continuation.continueWith(c); 16 i++; 17 } 18 assertTrue(i == count); 19 } 20 }