From 575364cc1f66142aa81f7130b04b7e65a8b50891 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 7 May 2019 21:00:22 +0200 Subject: [PATCH] Print exception's stacktrace in PacketWriterTest --- .../java/org/jivesoftware/smack/tcp/PacketWriterTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java b/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java index 59f25f40d..6404fce68 100644 --- a/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java +++ b/smack-tcp/src/test/java/org/jivesoftware/smack/tcp/PacketWriterTest.java @@ -33,6 +33,7 @@ import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.tcp.XMPPTCPConnection.PacketWriter; +import org.jivesoftware.smack.util.ExceptionUtil; import org.junit.jupiter.api.Test; import org.jxmpp.stringprep.XmppStringprepException; @@ -138,12 +139,14 @@ public class PacketWriterTest { if (prematureUnblocked) { String failureMessage = "Should not unblock before the thread got shutdown."; if (unexpectedThreadException != null) { - failureMessage += " Unexpected thread exception thrown: " + unexpectedThreadException; + String stacktrace = ExceptionUtil.getStackTrace(unexpectedThreadException); + failureMessage += " Unexpected thread exception thrown: " + unexpectedThreadException + "\n" + stacktrace; } fail(failureMessage); } else if (unexpectedThreadException != null) { - fail("Unexpected thread exception: " + unexpectedThreadException); + String stacktrace = ExceptionUtil.getStackTrace(unexpectedThreadException); + fail("Unexpected thread exception: " + unexpectedThreadException + "\n" + stacktrace); } assertNotNull(expectedThreadExceptionReference.get(), "Did not encounter expected exception on sendStreamElement()");