当前位置: 首页>>代码示例>>Java>>正文


Java InvokeMethod类代码示例

本文整理汇总了Java中org.junit.internal.runners.statements.InvokeMethod的典型用法代码示例。如果您正苦于以下问题:Java InvokeMethod类的具体用法?Java InvokeMethod怎么用?Java InvokeMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InvokeMethod类属于org.junit.internal.runners.statements包,在下文中一共展示了InvokeMethod类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: methodInvoker

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
/** {@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;
      }
    }
  };
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:20,代码来源:SwtBotRecordingTestRunner.java

示例2: runChild

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
/**
 * {@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);
        }
    }
}
 
开发者ID:vbauer,项目名称:jconditions,代码行数:23,代码来源:ConditionTestRunner.java

示例3: runSingleTest

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
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);
    }
}
 
开发者ID:stefanbirkner,项目名称:junit-playground,代码行数:20,代码来源:SfbRunner.java

示例4: runRule

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
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()));
    }
}
 
开发者ID:SergeyPirogov,项目名称:video-recorder-java,代码行数:12,代码来源:TestUtils.java

示例5: methodBlock

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
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);
}
 
开发者ID:diosmosis,项目名称:junit-composite-runner,代码行数:16,代码来源:TestRunner.java

示例6: methodInvoker

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:7,代码来源:LoadTimeWeavableTestRunner.java

示例7: methodInvoker

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
/**
 * Returns a {@link Statement} that invokes {@code method} on {@code test}
 */
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    return new InvokeMethod(method, test);
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:7,代码来源:BlockJUnit4ClassRunner.java

示例8: methodInvoker

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:lithiumtech,项目名称:multiverse-test,代码行数:8,代码来源:UnfinalizingTestRunner.java

示例9: buildStatement

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
protected Statement buildStatement(final TestClass testClass, final FrameworkMethod method, final Object target,
                                   final Description description, final RunNotifier notifier) {
    return new InvokeMethod(method, target);
}
 
开发者ID:bechte,项目名称:junit-hierarchicalcontextrunner,代码行数:5,代码来源:MethodExecutor.java

示例10: methodInvoker

import org.junit.internal.runners.statements.InvokeMethod; //导入依赖的package包/类
@Override
protected Statement methodInvoker(FrameworkMethod method, Object test) {
    ComplianceSuiteTest eTest = (ComplianceSuiteTest) test;
    eTest.setExecutor(executor);
    return new InvokeMethod(method, test);
}
 
开发者ID:52North,项目名称:SOS-Test-Suite,代码行数:7,代码来源:ComplianceSuiteTestRunner.java


注:本文中的org.junit.internal.runners.statements.InvokeMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。