return new Statement()
{
@Override
public void evaluate() throws Throwable
{
TestResult result = deployableTest.get().test(new TestMethodExecutor()
{
public void invoke() throws Throwable
{
try
{
Object parameterValues = TestEnrichers.enrich(deployableTest.get().getActiveContext(), getMethod());
method.invokeExplosively(test, (Object[])parameterValues);
}
catch (Throwable e)
{
// Force a way to return the thrown Exception from the Container the client.
caughtTestException.set(e);
throw e;
}
}
public Method getMethod()
{
return method.getMethod();
}
public Object getInstance()
{
return test;
}
});
if(result.getThrowable() != null)
{
throw result.getThrowable();
}
}
};
}