Skip to content

Commit

Permalink
strings-testframework: Also print the parts of the failed invalid JIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Aug 21, 2019
1 parent 0d82a49 commit 9829661
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
package org.jxmpp.strings.testframework;

import org.jxmpp.jid.Jid;
import org.jxmpp.jid.parts.Domainpart;
import org.jxmpp.jid.parts.Localpart;
import org.jxmpp.jid.parts.Resourcepart;
import org.jxmpp.stringprep.XmppStringprepException;

public abstract class InvalidJidTestresult {
Expand Down Expand Up @@ -58,6 +61,16 @@ public String toString() {
.append(invalidJid).append('\n')
.append("as it produced the following JID (when it should have thrown an exception):\n")
.append(jid).append('\n');
Localpart localpart = jid.getLocalpartOrNull();
if (localpart != null) {
sb.append("- localpart: ").append(localpart).append('\n');
}
Domainpart domainpart = jid.getDomain();
sb.append("- domanipart: ").append(domainpart).append('\n');
Resourcepart resourcepart = jid.getResourceOrNull();
if (resourcepart != null) {
sb.append("- resourcepart: ").append(resourcepart).append('\n');
}
return sb.toString();
}
}
Expand Down

0 comments on commit 9829661

Please sign in to comment.