From 3cfe31f3e42b6b68f6fe548a6be9f3f47342f91b Mon Sep 17 00:00:00 2001 From: heck Date: Sun, 13 Sep 2020 19:32:19 +0200 Subject: [PATCH] PityTest: TestUnit fix bug, not displaying exception on CTX_FAIL --- test/java/foundation/pEp/pitytest/TestUnit.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/java/foundation/pEp/pitytest/TestUnit.java b/test/java/foundation/pEp/pitytest/TestUnit.java index 1e4429d..d195cbb 100644 --- a/test/java/foundation/pEp/pitytest/TestUnit.java +++ b/test/java/foundation/pEp/pitytest/TestUnit.java @@ -90,7 +90,11 @@ public class TestUnit implements Runnable { } public Throwable getLastException() { - return lastException; + Throwable ret = new Throwable("No Exception caught"); + if(lastException != null) { + ret = lastException; + } + return ret; } public TestUnit add(TestSuite suite) { @@ -115,7 +119,7 @@ public class TestUnit implements Runnable { public void run() { TestUtils.standardOutErrEnabled(verboseMode); if (ctx.isUninitializable()) { - setTestState(TestState.CTX_FAIL); + setTestState(TestState.SKIPPED); TestUtils.standardOutErrEnabled(true); } else { try { @@ -177,7 +181,6 @@ public class TestUnit implements Runnable { } case CTX_FAIL: { setTestResult(TestState.SKIPPED); -// logH1(makeLogString()); break; } } @@ -188,7 +191,7 @@ public class TestUnit implements Runnable { result = r; TestUtils.standardOutErrEnabled(true); logH1(makeLogString()); - if (result == TestState.FAILED || result == TestState.CTX_FAIL) { + if (result == TestState.FAILED || state == TestState.CTX_FAIL) { log("ERROR: " + getLastException().toString()); } if (verboseMode) logRaw("\n\n");