use of org.junit.internal.runners.model.EachTestNotifier in project google-cloud-java by GoogleCloudPlatform.
the class ReadFormatTestRunner method runChild.
@Override
protected void runChild(JSONObject child, RunNotifier notifier) {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, describeChild(child));
eachNotifier.fireTestStarted();
try {
new TestCaseRunner(child).run();
eachNotifier.fireTestFinished();
} catch (Exception | AssertionError e) {
eachNotifier.addFailure(e);
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project mapstruct by mapstruct.
the class ProcessorSuiteRunner method runChild.
@Override
protected void runChild(ProcessorTestCase child, RunNotifier notifier) {
Description description = describeChild(child);
EachTestNotifier testNotifier = new EachTestNotifier(notifier, description);
if (child.ignored) {
testNotifier.fireTestIgnored();
} else {
try {
testNotifier.fireTestStarted();
doExecute(child, description);
} catch (AssumptionViolatedException e) {
testNotifier.fireTestIgnored();
} catch (StoppedByUserException e) {
throw e;
} catch (Throwable e) {
testNotifier.addFailure(e);
} finally {
testNotifier.fireTestFinished();
}
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project pravega by pravega.
the class SystemTestRunner method invokeTest.
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();
}
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project pinpoint by naver.
the class PinpointJUnit4ClassRunner method endTracing.
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();
}
}
}
use of org.junit.internal.runners.model.EachTestNotifier in project java-sdk by watson-developer-cloud.
the class RetryRunner method runTest.
private void runTest(Statement statement, Description description, RunNotifier notifier) {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
statement.evaluate();
} catch (AssumptionViolatedException e) {
eachNotifier.addFailedAssumption(e);
} catch (Throwable e) {
LOG.warning("Retry test: " + description.getDisplayName());
retry(eachNotifier, statement, e, description);
} finally {
eachNotifier.fireTestFinished();
}
}
Aggregations