use of org.junit.internal.runners.statements.Fail in project geode by apache.
the class PerTestClassLoaderRunner method methodBlock.
@Override
protected Statement methodBlock(FrameworkMethod method) {
FrameworkMethod newMethod = null;
try {
// Need the class from the custom loader now, so lets load the class.
loadClassesWithCustomClassLoader();
// The method as parameter is from the original class and thus not found in our
// class loaded by the custom name (reflection is class loader sensitive)
// So find the same method but now in the class from the class Loader.
Method methodFromNewlyLoadedClass = testClassFromClassLoader.getJavaClass().getMethod(method.getName());
newMethod = new FrameworkMethod(methodFromNewlyLoadedClass);
} catch (ClassNotFoundException e) {
// Show any problem nicely as a JUnit Test failure.
return new Fail(e);
} catch (SecurityException e) {
return new Fail(e);
} catch (NoSuchMethodException e) {
return new Fail(e);
}
// We can carry out the normal JUnit functionality with our newly discovered method now.
return super.methodBlock(newMethod);
}
use of org.junit.internal.runners.statements.Fail in project tomee by apache.
the class ValidationRunner method methodBlock.
@Override
protected Statement methodBlock(final FrameworkMethod method) {
final Object test;
try {
test = new ReflectiveCallable() {
@Override
protected Object runReflectiveCall() throws Throwable {
return createTest();
}
}.run();
} catch (final Throwable e) {
return new Fail(e);
}
Statement statement = new InvokeMethod(method, test);
statement = withBefores(method, test, statement);
statement = withAfters(method, test, statement);
return statement;
}
Aggregations