org.junit.TestsFailed Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-gwt Show documentation
Show all versions of xapi-gwt Show documentation
This module exists solely to package all other gwt modules into a single
uber jar. This makes deploying to non-mavenized targets much easier.
Of course, you would be wise to inherit your dependencies individually;
the uber jar is intended for projects like collide,
which have complex configuration, and adding many jars would be a pain.
The newest version!
package org.junit;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Map.Entry;
public class TestsFailed extends Exception {
private static final long serialVersionUID = 2797492826431755971L;
private final Map results;
public TestsFailed(Map result) {
super(serialize(result));
this.results = result;
}
private static String serialize(Map result) {
StringBuilder pass = new StringBuilder();
StringBuilder fail = new StringBuilder("\n");
for (Entry e : result.entrySet()) {
if (e.getValue() == null) {
pass.append(e.getKey().getName()).append("\n (pass)");
} else {
fail.append(e.getKey().getName()).append("\n (FAIL):");
print(fail, e.getValue());
}
}
return fail.append(pass).toString();
}
private static void print(StringBuilder b, Throwable e) {
while (e != null) {
b.append(e).append("\n");
for (StackTraceElement trace : e.getStackTrace()) {
b.append("\t ").append(trace).append("\n");
}
e = e.getCause();
}
}
public Map getResults() {
return results;
}
}