From f3cbc350cd89cef14ae9de022efccc9cafdb1add Mon Sep 17 00:00:00 2001 From: SMan Date: Wed, 5 Jan 2022 23:28:19 -0600 Subject: [PATCH] fix: listener has been updated; --- .../jans/as/server/JansUnitTestsListener.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/server/src/test/java/io/jans/as/server/JansUnitTestsListener.java b/server/src/test/java/io/jans/as/server/JansUnitTestsListener.java index fa007448875..ef1eafef5f6 100644 --- a/server/src/test/java/io/jans/as/server/JansUnitTestsListener.java +++ b/server/src/test/java/io/jans/as/server/JansUnitTestsListener.java @@ -25,30 +25,22 @@ public void onStart(ITestContext context) { } @Override - public void onTestFailedButWithinSuccessPercentage(ITestResult context) { + public void onTestFailedButWithinSuccessPercentage(ITestResult result) { + Reporter.log("Test FAILED with Success Percentage: " + result.getName() + "." + result.getMethod().getMethodName(), true); + testFailed(result); } @Override public void onTestFailure(ITestResult result) { Reporter.log("Test FAILED: " + result.getName() + "." + result.getMethod().getMethodName(), true); - Object[] parameters = result.getParameters(); - if(parameters != null) { - Reporter.log("Test Parameters: ", true); - for(Object parameter : parameters) { - Reporter.log("parameter = " + parameter, true); - } - } - Throwable throwable = result.getThrowable(); - if(throwable != null) { - Reporter.log("", true); - Reporter.log("Exception: ", true); - Reporter.log(Throwables.getStackTraceAsString(result.getThrowable()), true); - Reporter.log("", true); - } + testFailed(result); + Reporter.log("", true); } @Override public void onTestSkipped(ITestResult result) { + Reporter.log("Test SKIPPED: " + result.getName() + "." + result.getMethod().getMethodName(), true); + Reporter.log("", true); } @Override @@ -61,4 +53,21 @@ public void onTestSuccess(ITestResult result) { Reporter.log("Test SUCCESS: " + result.getName() + "." + result.getMethod().getMethodName(), true); Reporter.log("", true); } + + private void testFailed(ITestResult result) { + Object[] parameters = result.getParameters(); + if(parameters != null) { + Reporter.log("Test Parameters: ", true); + for(Object parameter : parameters) { + Reporter.log("parameter = " + parameter, true); + } + } + Throwable throwable = result.getThrowable(); + if(throwable != null) { + Reporter.log("", true); + Reporter.log("Exception: ", true); + Reporter.log(Throwables.getStackTraceAsString(result.getThrowable()), true); + Reporter.log("", true); + } + } }