You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/03/07 15:45:41 UTC

[commons-pool] branch master updated: Better test failure message

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new 26018455 Better test failure message
26018455 is described below

commit 26018455029381ff1d4fc80a2dbbb66a52ef0b7a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Mar 7 10:45:36 2023 -0500

    Better test failure message
---
 .../org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
index dbd28c28..87552a6b 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
@@ -804,12 +804,6 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
         return sb.toString();
     }
 
-    private String getExceptionTrace(final Throwable t){
-        final StringWriter sw = new StringWriter();
-        t.printStackTrace(new PrintWriter(sw));
-        return sw.toString();
-    }
-
     @Override
     protected Object getNthObject(final Object key, final int n) {
         return String.valueOf(key) + String.valueOf(n);
@@ -871,7 +865,7 @@ public class TestGenericKeyedObjectPool extends TestKeyedObjectPool {
                 Waiter.sleepQuietly(500L);
             }
             if (testThread.failed()) {
-                fail("Thread failed: " + threads.indexOf(testThread) + "\n" + getExceptionTrace(testThread.exception));
+                fail("Thread failed: " + threads.indexOf(testThread) + "\n" + ExceptionUtils.getStackTrace(testThread.exception));
             }
         }
     }