类org.junit.internal.runners.model.EachTestNotifier源码实例Demo

下面列出了怎么用org.junit.internal.runners.model.EachTestNotifier的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: pravega   文件: SystemTestRunner.java
private void invokeTest(RunNotifier notifier, TestExecutorType type, FrameworkMethod method) {
    if ((type == null) || TestExecutorType.LOCAL.equals(type)) {
        runLeaf(methodBlock(method), describeChild(method), notifier);
    } else {
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, describeChild(method));
        try {
            eachNotifier.fireTestStarted();
            execute(type, method.getMethod()).get();
        } catch (Throwable e) {
            log.error("Test " + method + " failed with exception ", e);
            eachNotifier.addFailure(unwrap(e));
        } finally {
            eachNotifier.fireTestFinished();
        }
    }
}
 
源代码2 项目: tinkerpop   文件: GremlinProcessRunner.java
@Override
public void runChild(final FrameworkMethod method, final RunNotifier notifier) {
    final Description description = describeChild(method);
    if (this.isIgnored(method)) {
        notifier.fireTestIgnored(description);
    } else {
        final EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        boolean ignored = false;
        try {
            this.methodBlock(method).evaluate();
        } catch (AssumptionViolatedException ave) {
            eachNotifier.addFailedAssumption(ave);
        } catch (Throwable e) {
            if (validateForGraphComputer(e)) {
                eachNotifier.fireTestIgnored();
                logger.info(e.getMessage());
                ignored = true;
            } else
                eachNotifier.addFailure(e);
        } finally {
            if (!ignored)
                eachNotifier.fireTestFinished();
        }
    }
}
 
源代码3 项目: pinpoint   文件: PinpointJUnit4ClassRunner.java
private void endTracing(FrameworkMethod method, RunNotifier notifier) {
    if (shouldCreateNewTraceObject(method)) {
        TraceContext traceContext = getTraceContext();
        try {
            Trace trace = traceContext.currentRawTraceObject();
            if (trace == null) {
                // Trace is already detached from the ThreadLocal storage.
                // Happens when root trace method is tested without @IsRootSpan.
                EachTestNotifier testMethodNotifier = new EachTestNotifier(notifier, super.describeChild(method));
                String traceObjectAlreadyDetachedMessage = "Trace object already detached. If you're testing a trace root, please add @IsRootSpan to the test method";
                testMethodNotifier.addFailure(new IllegalStateException(traceObjectAlreadyDetachedMessage));
            } else {
                trace.close();
            }
        } finally {
            traceContext.removeTraceObject();
        }
    }
}
 
源代码4 项目: HiveRunner   文件: StandaloneHiveRunner.java
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
    Description description = describeChild(method);
    if (method.getAnnotation(Ignore.class) != null) {
        notifier.fireTestIgnored(description);
    } else {
        setLogContext(method);
        EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
        eachNotifier.fireTestStarted();
        try {
            runTestMethod(method, eachNotifier, config.getTimeoutRetries());
        } finally {
            eachNotifier.fireTestFinished();
            clearLogContext();
        }
    }
}
 
源代码5 项目: flink   文件: FlinkStandaloneHiveRunner.java
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
	Description description = describeChild(method);
	if (method.getAnnotation(Ignore.class) != null) {
		notifier.fireTestIgnored(description);
	} else {
		EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
		eachNotifier.fireTestStarted();
		try {
			runTestMethod(method, eachNotifier);
		} finally {
			eachNotifier.fireTestFinished();
		}
	}
}
 
源代码6 项目: java-sdk   文件: RetryRunner.java
@Override
public void run(final RunNotifier notifier) {
  EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription());
  Statement statement = classBlock(notifier);
  try {
    statement.evaluate();
  } catch (AssumptionViolatedException ave) {
    testNotifier.fireTestIgnored();
  } catch (StoppedByUserException sbue) {
    throw sbue;
  } catch (Throwable t) {
    LOG.warning("Retry class: " + getDescription().getDisplayName());
    retry(testNotifier, statement, t, getDescription());
  }
}
 
源代码7 项目: flink   文件: FlinkStandaloneHiveRunner.java
@Override
protected void runChild(final FrameworkMethod method, RunNotifier notifier) {
	Description description = describeChild(method);
	if (method.getAnnotation(Ignore.class) != null) {
		notifier.fireTestIgnored(description);
	} else {
		EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
		eachNotifier.fireTestStarted();
		try {
			runTestMethod(method, eachNotifier);
		} finally {
			eachNotifier.fireTestFinished();
		}
	}
}
 
源代码8 项目: cougar   文件: ParameterizedMultiRunner.java
protected EachTestNotifier makeNotifier(FrameworkMethod method,
                                        RunNotifier notifier) {
    Description description= describeChild(method);
    return new EachTestNotifier(notifier, description);
}
 
源代码9 项目: cougar   文件: MultiRunner.java
protected EachTestNotifier makeNotifier(FrameworkMethod method,
                                        RunNotifier notifier) {
    Description description= describeChild(method);
    return new EachTestNotifier(notifier, description);
}
 
源代码10 项目: tds   文件: SpringJUnit4ParameterizedClassRunner.java
/**
 * <code>springMakeNotifier()</code> is an exact copy of
 * {@link BlockJUnit4ClassRunner BlockJUnit4ClassRunner's}
 * <code>makeNotifier()</code> method, but we have decided to prefix it with
 * "spring" and keep it <code>private</code> in order to avoid the
 * compatibility clashes that were introduced in JUnit between versions 4.5,
 * 4.6, and 4.7.
 */
private EachTestNotifier springMakeNotifier(FrameworkMethod method, RunNotifier notifier) {
  Description description = describeChild(method);
  return new EachTestNotifier(notifier, description);
}
 
源代码11 项目: dsl-devkit   文件: ClassRunner.java
/**
 * Creates a notifier for each test.
 *
 * @param method
 *          the {@link FrameworkMethod}, must not be {@code null}
 * @param notifier
 *          the {@link RunNotifier}, must not be {@code null}
 * @return an instance of {@link EachTestNotifier}, never {@code null}
 */
private EachTestNotifier createNotifier(final FrameworkMethod method, final RunNotifier notifier) {
  return new EachTestNotifier(notifier, describeChild(method));
}
 
 类所在包
 同包方法