|
|
@@ -8,6 +8,7 @@ package net.ranides.assira.junit;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
+import java.io.PrintStream;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.lang.reflect.Method;
|
|
|
@@ -23,6 +24,7 @@ import java.util.SortedSet;
|
|
|
import java.util.TreeSet;
|
|
|
import java.util.function.Supplier;
|
|
|
import javax.annotation.Resource;
|
|
|
+import junit.framework.Assert;
|
|
|
import org.junit.Ignore;
|
|
|
|
|
|
/**
|
|
|
@@ -88,10 +90,21 @@ public class InterfaceSuite {
|
|
|
public boolean run(Supplier<?> generator) {
|
|
|
Class<?> type = generator.get().getClass();
|
|
|
Counter counter = new Counter();
|
|
|
+ List<Exception> errors = new ArrayList<>();
|
|
|
for(MethodRunner m : methods) {
|
|
|
if( m.accept(type)) {
|
|
|
- m.run(counter, generator);
|
|
|
+ try {
|
|
|
+ m.run(counter, generator);
|
|
|
+ } catch(Exception cause) {
|
|
|
+ errors.add(cause);
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ for(Exception cause : errors) {
|
|
|
+ cause.printStackTrace(new PrintStream(output));
|
|
|
+ }
|
|
|
+ if(!errors.isEmpty()) {
|
|
|
+ Assert.fail("Failed interface tests: " + errors.size() + "/"+counter.value);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -155,6 +168,12 @@ public class InterfaceSuite {
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
+ printf(" - SUITE: %s [%d] %s.%s - FAILED%n",
|
|
|
+ type.getName(),
|
|
|
+ counter.next(),
|
|
|
+ method.getDeclaringClass().getSimpleName(),
|
|
|
+ method.getName()
|
|
|
+ );
|
|
|
throw NewAssert.rethrow(ex.getTargetException());
|
|
|
}
|
|
|
}
|