}
@SuppressWarnings("rawtypes")
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
EachTestNotifier eachNotifier = makeNotifier(method, notifier);
if (method.getAnnotation(Ignore.class) != null) {
eachNotifier.fireTestIgnored();
return;
}
eachNotifier.fireTestStarted();
try {
try {
test = new ReflectiveCallable() {
@Override
protected Object runReflectiveCall() throws Throwable {
return createTest();
}
}.run();
} catch (Throwable e) {
new Fail(e).evaluate();
}
QCCheckStatement qcStatement = methodInvoker(method, test);
Statement statement = methodBlock(method, qcStatement);
// if (method.getMethod().getParameterTypes().length == 0) {
// // If this is a test that has no parameters, only
// // run it once as JUnit normally does
// statement.evaluate();
// System.out.println(method.getName() + ": OK. Passed 1 tests.");
// } else {
for (int i = 0; i < qcStatement.getMaxNumberOfTests(); i++) {
try {
statement.evaluate();
} catch(Yaqc4jAssertionFailedError failure){
System.out.println(method.getName() + " failed. " + failure.getMessage());
throw failure;
} catch(AssertionError failure){
System.out.println(method.getName() + ": Failed after " + (i + 1) + " tests." + failure.getMessage());
throw failure;
}
}
for (Collector collector: qcStatement.getcollectors()){
if (collector != null){
System.out.println(collector.printResults());
}
}
for (ClassifyResults classifiers: qcStatement.getClassifiers()){
if (classifiers != null){
System.out.println(classifiers.printResults());
}
}
System.out.println(method.getName() + ": OK. Passed " + qcStatement.getMaxNumberOfTests() + " tests.");
// }
} catch (AssumptionViolatedException e) {
eachNotifier.addFailedAssumption(e);
} catch (Throwable e) {
eachNotifier.addFailure(e);
} finally {
eachNotifier.fireTestFinished();
}
}