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
1 changed files with 5 additions and 2 deletions

View File

@ -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()");