org.junit.internal.runners.statements.InvokeMethod Java Examples

The following examples show how to use org.junit.internal.runners.statements.InvokeMethod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SwtBotRecordingTestRunner.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Statement methodInvoker(final FrameworkMethod method, final Object test) {
  return new InvokeMethod(method, test) {
    @Override
    // CHECKSTYLE:CHECK-OFF IllegalThrow // inherited JUnit throw style
    public void evaluate() throws Throwable {
      // CHECKSTYLE:CHECK-ON IllegalThrow
      try {
        super.evaluate();
        // CHECKSTYLE:CHECK-OFF IllegalCatch // catching in order to act upon but then throwing the exception again
      } catch (final Throwable throwable) {
        // CHECKSTYLE:CHECK-ON IllegalCatch
        testRunRecording.methodInvokeFailure(throwable);
        throw throwable;
      }
    }
  };
}
 
Example #2
Source File: TestUtils.java    From video-recorder-java with MIT License 5 votes vote down vote up
public static void runRule(TestRule rule, Object target, String methodName) {
    Class<?> clazz = target.getClass();
    Method method = TestUtils.getMethod(clazz, methodName);
    Description description = Description.createTestDescription(clazz, method.getName(), method.getDeclaredAnnotations());
    try {
        InvokeMethod invokeMethod = new InvokeMethod(new FrameworkMethod(method), target);
        rule.apply(invokeMethod, description).evaluate();
    } catch (Throwable throwable) {
        logger.warning(Arrays.toString(throwable.getStackTrace()));
    }
}
 
Example #3
Source File: LoadTimeWeavableTestRunner.java    From rice with Educational Community License v2.0 4 votes vote down vote up
/**
 * Returns a {@link org.junit.runners.model.Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}