Java 类org.junit.internal.runners.statements.InvokeMethod 实例源码

项目:dsl-devkit    文件:SwtBotRecordingTestRunner.java   
/** {@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;
      }
    }
  };
}
项目:jconditions    文件:ConditionTestRunner.java   
/**
 * {@inheritDoc}
 */
@Override
protected void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    final Description description = describeChild(method);
    if (isIgnored(method)) {
        notifier.fireTestIgnored(description);
    } else {
        final InvokeMethod statement = (InvokeMethod) methodBlock(method);
        final Object test = ReflexUtils.getFieldValue(statement, "target");

        final ConditionChecker<?> checker =
            ConditionCheckerEngine.detectFailedChecker(test, method);

        if (checker != null) {
            notifier.fireTestIgnored(description);
        } else {
            runLeaf(statement, description, notifier);
        }
    }
}
项目:junit-playground    文件:SfbRunner.java   
private void runSingleTest(FrameworkMethod method, RunNotifier notifier) throws IllegalAccessException,
        InvocationTargetException, InstantiationException {
    Object test = getTestClass().getOnlyConstructor().newInstance();
    Statement statement = new InvokeMethod(method, test);
    Description description = describeChild(method);
    notifier.fireTestStarted(description);
    try {
        statement.evaluate();
        if (method.getName().endsWith("MustFail")) {
            notifier.fireTestFailure(new Failure(description, new RuntimeException("Test didn't fail.")));
        }
    } catch (Throwable e) {
        if (!method.getName().endsWith("MustFail")) {
            notifier.fireTestFailure(new Failure(description, e));
        }
    } finally {
        notifier.fireTestFinished(description);
    }
}
项目:video-recorder-java    文件:TestUtils.java   
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()));
    }
}
项目:junit-composite-runner    文件:TestRunner.java   
private Statement methodBlock(FrameworkMethod method) {
    Object testObject;
    try {
        testObject = new ReflectiveCallable() {
            @Override
            protected Object runReflectiveCall() throws Throwable {
                return getTestClass().getOnlyConstructor().newInstance(new Object[0]);
            }
        }.run();
    } catch (Throwable throwable) {
        return new Fail(throwable);
    }

    return new InvokeMethod(method, testObject);
}
项目:kc-rice    文件:LoadTimeWeavableTestRunner.java   
/**
 * 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);
}
项目:sosiefier    文件:BlockJUnit4ClassRunner.java   
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}
项目:lcm    文件:BlockJUnit4ClassRunner.java   
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}
项目:rice    文件:LoadTimeWeavableTestRunner.java   
/**
 * 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);
}
项目:multiverse-test    文件:UnfinalizingTestRunner.java   
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
@Override
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(convert(method), test);
}
项目:junit-hierarchicalcontextrunner    文件:MethodExecutor.java   
protected Statement buildStatement(final TestClass testClass, final FrameworkMethod method, final Object target,
                                   final Description description, final RunNotifier notifier) {
    return new InvokeMethod(method, target);
}
项目:junit    文件:BlockJUnit4ClassRunner.java   
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}
项目:org.openntf.domino    文件:BlockJUnit4ClassRunner.java   
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}
项目:SOS-Test-Suite    文件:ComplianceSuiteTestRunner.java   
@Override
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    ComplianceSuiteTest eTest = (ComplianceSuiteTest) test;
    eTest.setExecutor(executor);
    return new InvokeMethod(method, test);
}