import java.util.ArrayList;
import java.util.List;
-import be.nikiroo.utils.test.TestCase.AssertException;
-
/**
* A {@link TestLauncher} starts a series of {@link TestCase}s and displays the
* result to the user.
private class SetupException extends Exception {
private static final long serialVersionUID = 1L;
- public SetupException(Exception e) {
+ public SetupException(Throwable e) {
super(e);
}
}
private class TearDownException extends Exception {
private static final long serialVersionUID = 1L;
- public TearDownException(Exception e) {
+ public TearDownException(Throwable e) {
super(e);
}
}
for (TestCase test : tests) {
print(depth, test.getName());
- Exception ex = null;
+ Throwable ex = null;
try {
try {
test.setUp();
- } catch (Exception e) {
+ } catch (Throwable e) {
throw new SetupException(e);
}
test.test();
try {
test.tearDown();
- } catch (Exception e) {
+ } catch (Throwable e) {
throw new TearDownException(e);
}
- } catch (Exception e) {
+ } catch (Throwable e) {
ex = e;
}
*
* @param depth
* the level at which is the launcher (0 = main launcher)
- * @param test
- * the {@link TestCase}
+ * @param name
+ * the {@link TestCase} name
*/
protected void print(int depth, String name) {
name = prefix(depth, false)
* @param error
* the {@link Exception} it ran into if any
*/
- private void print(int depth, Exception error) {
+ private void print(int depth, Throwable error) {
if (error != null) {
System.out.println(" " + koString);
- String lines = error.getMessage() + "";
- if (!(error instanceof AssertException)) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- error.printStackTrace(pw);
- lines = sw.toString();
- }
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ error.printStackTrace(pw);
+ String lines = sw.toString();
for (String line : lines.split("\n")) {
System.out.println(prefix(depth, false) + "\t\t" + line);
}