aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/standalone/output/TextTestWriter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/cz/crcs/ectester/standalone/output/TextTestWriter.java')
-rw-r--r--src/cz/crcs/ectester/standalone/output/TextTestWriter.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/cz/crcs/ectester/standalone/output/TextTestWriter.java b/src/cz/crcs/ectester/standalone/output/TextTestWriter.java
index 972af18..bf9ec7d 100644
--- a/src/cz/crcs/ectester/standalone/output/TextTestWriter.java
+++ b/src/cz/crcs/ectester/standalone/output/TextTestWriter.java
@@ -1,8 +1,12 @@
package cz.crcs.ectester.standalone.output;
+import cz.crcs.ectester.common.cli.Colors;
import cz.crcs.ectester.common.output.BaseTextTestWriter;
import cz.crcs.ectester.common.test.TestSuite;
import cz.crcs.ectester.common.test.Testable;
+import cz.crcs.ectester.standalone.ECTesterStandalone;
+import cz.crcs.ectester.standalone.test.base.StandaloneTestable;
+import cz.crcs.ectester.standalone.test.suites.StandaloneTestSuite;
import java.io.PrintStream;
@@ -14,15 +18,38 @@ public class TextTestWriter extends BaseTextTestWriter {
super(output);
}
+ private String causeString(Object cause) {
+ if (cause == null) {
+ return "";
+ } else if (cause instanceof Exception) {
+ Exception ex = ((Exception) cause);
+ return " -> " + ex.getClass().getCanonicalName() + " : " + ex.getMessage();
+ } else {
+ return cause.toString();
+ }
+ }
+
@Override
protected String testableString(Testable t) {
- //TODO
+ if (t instanceof StandaloneTestable) {
+ StandaloneTestable<?> testable = (StandaloneTestable) t;
+ String stage = testable.getStage().name();
+ String exception = causeString(testable.getException());
+ String errorCause = causeString(testable.errorCause());
+ return stage + exception + errorCause;
+ }
return "";
}
@Override
protected String deviceString(TestSuite suite) {
- //TODO
+ if (suite instanceof StandaloneTestSuite) {
+ StandaloneTestSuite standaloneSuite = (StandaloneTestSuite) suite;
+ StringBuilder sb = new StringBuilder();
+ sb.append("═══ ").append(Colors.underline("ECTester version:")).append(" ").append(ECTesterStandalone.VERSION).append(System.lineSeparator());
+ sb.append("═══ ").append(Colors.underline("Library:")).append(" ").append(standaloneSuite.getLibrary().name()).append(System.lineSeparator());
+ return sb.toString();
+ }
return "";
}
} \ No newline at end of file