use of org.apache.openejb.junit.context.TestContext in project tomee by apache.
the class JUnit4Runner method createUnsecuredStatement.
/**
* Builds a method statement that executes in an unauthenticated context
*/
protected Statement createUnsecuredStatement(final FrameworkMethod method) {
final Object test = newTestInstance();
Statement statement = methodInvoker(method, test);
statement = possiblyExpectingExceptions(method, test, statement);
statement = withPotentialTimeout(method, test, statement);
statement = withBefores(method, test, statement);
statement = withAfters(method, test, statement);
final TestContext context = runner.newTestContext(method.getMethod());
return new ContextWrapperStatement(context, statement, test);
}
use of org.apache.openejb.junit.context.TestContext in project tomee by apache.
the class JUnit4Runner method createSecuredStatement.
/**
* Create a new statement to run with a given role and whether it should fail or not.
*
* @param method
* @param role
* @param failWithAccessException
* @return statement
*/
private Statement createSecuredStatement(final FrameworkMethod method, final String role, final boolean failWithAccessException) {
final Object test = newTestInstance();
Statement statement = methodInvoker(method, test);
statement = possiblyExpectingAccessException(statement, failWithAccessException);
// specified in @Test
statement = possiblyExpectingExceptions(method, test, statement);
statement = withPotentialTimeout(method, test, statement);
statement = withBefores(method, test, statement);
statement = withAfters(method, test, statement);
final TestContext context = runner.newTestContext(method.getMethod(), role);
return new ContextWrapperStatement(context, statement, test);
}
Aggregations