diff options
| author | J08nY | 2018-05-28 21:45:19 +0200 |
|---|---|---|
| committer | J08nY | 2018-05-28 21:45:19 +0200 |
| commit | 298ffc18e590d07eb04d2c5c2b1d553f8fba71bd (patch) | |
| tree | 3eccc379deb68a920951cc29c7bcb17368933fde /src/cz/crcs/ectester/standalone/output/TextTestWriter.java | |
| parent | a4e52b21b1dad5f96df409c44e5b4d611bba01b9 (diff) | |
| download | ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.tar.gz ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.tar.zst ECTester-298ffc18e590d07eb04d2c5c2b1d553f8fba71bd.zip | |
Implement tracking and writing of exceptions in standalone tests.
Diffstat (limited to 'src/cz/crcs/ectester/standalone/output/TextTestWriter.java')
| -rw-r--r-- | src/cz/crcs/ectester/standalone/output/TextTestWriter.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/cz/crcs/ectester/standalone/output/TextTestWriter.java b/src/cz/crcs/ectester/standalone/output/TextTestWriter.java index 691bea8..2e29b07 100644 --- a/src/cz/crcs/ectester/standalone/output/TextTestWriter.java +++ b/src/cz/crcs/ectester/standalone/output/TextTestWriter.java @@ -4,10 +4,9 @@ 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.*; +import cz.crcs.ectester.standalone.test.base.StandaloneTestable; import cz.crcs.ectester.standalone.test.suites.StandaloneTestSuite; -import javax.crypto.KeyAgreement; import java.io.PrintStream; /** @@ -18,10 +17,25 @@ 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) { if (t instanceof StandaloneTestable) { - return ((StandaloneTestable)t).getStage().name(); + StandaloneTestable<?> testable = (StandaloneTestable) t; + String stage = testable.getStage().name(); + String exception = causeString(testable.getException()); + String errorCause = causeString(testable.errorCause()); + return stage + exception + errorCause; } return ""; } |
