use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class InstrumentationOptimizerTest method testDontSkipForwardsWithTryCatch.
@Test
public void testDontSkipForwardsWithTryCatch() throws InterruptedException, SuspendExecution, ExecutionException {
new Fiber(new SuspendableRunnable() {
@Override
public void run() throws SuspendExecution, InterruptedException {
dontSkipForwardsWithTryCatch();
}
}).start().join();
assertFalse(isOptimized("skipForwardsWithTryCatch"));
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class Merge2Test method testMerge2.
@Test
public void testMerge2() {
try {
Fiber c = new Fiber((String) null, null, new Merge2Test());
TestsHelper.exec(c);
assertTrue("Should not reach here", false);
} catch (NullPointerException ex) {
// NPE expected
}
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class MergeTest method testMerge.
@Test
public void testMerge() {
Fiber c = new Fiber((String) null, null, new MergeTest());
TestsHelper.exec(c);
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class NullTest method testNull.
@Test
public void testNull() {
Fiber co = new Fiber((String) null, null, this);
int count = 1;
while (!TestsHelper.exec(co)) count++;
assertEquals(2, count);
assertEquals("a", result);
}
use of co.paralleluniverse.fibers.Fiber in project quasar by puniverse.
the class SuspendableAnnotationTest method testAnnotated.
@Test
public void testAnnotated() {
try {
Fiber co = new Fiber((String) null, null, (SuspendableCallable) null) {
@Override
protected Object run() throws SuspendExecution, InterruptedException {
suspendableMethod();
return null;
}
};
exec(co);
exec(co);
exec(co);
} finally {
System.out.println(results);
}
assertEquals(3, results.size());
assertEquals(Arrays.asList("A", "B", "C"), results);
}
Aggregations