in src/main/java/com/amazonaws/services/simpleworkflow/flow/junit/WorkflowTestStatement.java [53:110]
public void evaluate() throws Throwable {
if (!flowTestRunner) {
throw new IllegalStateException(
"WorkflowTest rule can be used only with flow specific test runners: FlowBlockJUnit4ClassRunner and FlowSpringJUnit4ClassRunner");
}
final WorkflowTestBase workflowTest = workflowTestAccessor.call();
Thread t = null;
if (timeout == null || timeout == 0) {
try {
asyncEvaluate(workflowTest);
completed = true;
}
catch (Throwable e) {
failure = e;
}
}
else {
t = new Thread() {
public void run() {
try {
asyncEvaluate(workflowTest);
completed = true;
}
catch (Throwable e) {
failure = e;
}
}
};
t.start();
t.join(timeout);
}
if (failure != null) {
if (expectedException != null && expectedException.isAssignableFrom(failure.getClass())) {
return;
}
throw failure;
}
if (!completed) {
if (waitingOnTimer) {
AssertionError e = new AssertionError("Test timed out after " + timeout
+ " milliseconds. The following asynchrous tasks are outstanding: \n"
+ workflowTest.scope.getAsynchronousThreadDumpAsString());
throw e;
}
else {
AssertionError e = new AssertionError("Test timed out after " + timeout + " milliseconds");
if (t != null) {
e.setStackTrace(t.getStackTrace());
}
throw e;
}
}
if (expectedException != null) {
throw new AssertionError("Expected exception: " + expectedException);
}
}