use of co.paralleluniverse.fibers.VerifyInstrumentationException in project quasar by puniverse.
the class VerificationTest method testVerifyUninstrumentedMethod.
@Test
public final void testVerifyUninstrumentedMethod() throws ExecutionException, InterruptedException {
assumeTrue(SystemProperties.isEmptyOrTrue("co.paralleluniverse.fibers.verifyInstrumentation"));
final I1 i1 = new C1();
Throwable t = null;
final Fiber<?> fUninstrumentedMethod1 = new Fiber<>(new SuspendableRunnable() {
@Override
public final void run() throws SuspendExecution, InterruptedException {
try {
// **
doUninstrumented();
Fiber.sleep(10);
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}).start();
try {
fUninstrumentedMethod1.join();
} catch (final ExecutionException re) {
t = re.getCause().getCause();
t.printStackTrace();
}
assertTrue(t instanceof VerifyInstrumentationException && t.getMessage().contains(" **"));
final Fiber<?> fUninstrumentedMethod2 = new Fiber(new SuspendableRunnable() {
@Override
public final void run() throws SuspendExecution, InterruptedException {
try {
i1.doIt();
} finally {
i1.doIt();
}
}
}).start();
try {
fUninstrumentedMethod2.join();
} catch (final ExecutionException re) {
t = re.getCause();
t.printStackTrace();
}
assertTrue(t instanceof VerifyInstrumentationException && t.getMessage().contains(" **"));
}
Aggregations