1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 00:02:06 +01:00

Print exception's stacktrace in PacketWriterTest

This commit is contained in:
Florian Schmaus 2019-05-07 21:00:22 +02:00
parent e1ed035beb
commit 575364cc1f

View file

@ -33,6 +33,7 @@ import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.tcp.XMPPTCPConnection.PacketWriter; import org.jivesoftware.smack.tcp.XMPPTCPConnection.PacketWriter;
import org.jivesoftware.smack.util.ExceptionUtil;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.jxmpp.stringprep.XmppStringprepException; import org.jxmpp.stringprep.XmppStringprepException;
@ -138,12 +139,14 @@ public class PacketWriterTest {
if (prematureUnblocked) { if (prematureUnblocked) {
String failureMessage = "Should not unblock before the thread got shutdown."; String failureMessage = "Should not unblock before the thread got shutdown.";
if (unexpectedThreadException != null) { if (unexpectedThreadException != null) {
failureMessage += " Unexpected thread exception thrown: " + unexpectedThreadException; String stacktrace = ExceptionUtil.getStackTrace(unexpectedThreadException);
failureMessage += " Unexpected thread exception thrown: " + unexpectedThreadException + "\n" + stacktrace;
} }
fail(failureMessage); fail(failureMessage);
} }
else if (unexpectedThreadException != null) { 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()"); assertNotNull(expectedThreadExceptionReference.get(), "Did not encounter expected exception on sendStreamElement()");