Merge pull request #139 from vanitasvitae/JingleErrors

Remove unused errors and add missing ones
This commit is contained in:
Florian Schmaus 2017-06-16 23:19:50 +02:00 committed by GitHub
commit 6712cc91c8
2 changed files with 15 additions and 15 deletions

View File

@ -28,11 +28,11 @@ public final class JingleError implements ExtensionElement {
public static final JingleError OUT_OF_ORDER = new JingleError("out-of-order"); public static final JingleError OUT_OF_ORDER = new JingleError("out-of-order");
public static final JingleError TIE_BREAK = new JingleError("tie-break");
public static final JingleError UNKNOWN_SESSION = new JingleError("unknown-session"); public static final JingleError UNKNOWN_SESSION = new JingleError("unknown-session");
public static final JingleError UNSUPPORTED_CONTENT = new JingleError("unsupported-content"); public static final JingleError UNSUPPORTED_INFO = new JingleError("unsupported-info");
public static final JingleError UNSUPPORTED_TRANSPORTS = new JingleError("unsupported-transports");
private final String errorName; private final String errorName;
@ -71,10 +71,10 @@ public final class JingleError implements ExtensionElement {
return OUT_OF_ORDER; return OUT_OF_ORDER;
case "unknown-session": case "unknown-session":
return UNKNOWN_SESSION; return UNKNOWN_SESSION;
case "unsupported-content": case "tie-break":
return UNSUPPORTED_CONTENT; return TIE_BREAK;
case "unsupported-transports": case "unsupported-info":
return UNSUPPORTED_TRANSPORTS; return UNSUPPORTED_INFO;
default: default:
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -16,15 +16,15 @@
*/ */
package org.jivesoftware.smackx.jingle; package org.jivesoftware.smackx.jingle;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smackx.jingle.element.JingleError; import org.jivesoftware.smackx.jingle.element.JingleError;
import org.junit.Test; import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.fail;
/** /**
* Test the JingleError class. TODO: Uncomment missing tests once implemented. * Test the JingleError class.
*/ */
public class JingleErrorTest extends SmackTestSuite { public class JingleErrorTest extends SmackTestSuite {
@ -32,12 +32,12 @@ public class JingleErrorTest extends SmackTestSuite {
public void parserTest() { public void parserTest() {
assertEquals("<out-of-order xmlns='urn:xmpp:jingle:errors:1'/>", assertEquals("<out-of-order xmlns='urn:xmpp:jingle:errors:1'/>",
JingleError.fromString("out-of-order").toXML().toString()); JingleError.fromString("out-of-order").toXML().toString());
//assertEquals("<tie-break xmlns='urn:xmpp:jingle:errors:1'/>", assertEquals("<tie-break xmlns='urn:xmpp:jingle:errors:1'/>",
// JingleError.fromString("tie-break").toXML().toString()); JingleError.fromString("tie-break").toXML().toString());
assertEquals("<unknown-session xmlns='urn:xmpp:jingle:errors:1'/>", assertEquals("<unknown-session xmlns='urn:xmpp:jingle:errors:1'/>",
JingleError.fromString("unknown-session").toXML().toString()); JingleError.fromString("unknown-session").toXML().toString());
//assertEquals("<unsupported-info xmlns='urn:xmpp:jingle:errors:1'/>", assertEquals("<unsupported-info xmlns='urn:xmpp:jingle:errors:1'/>",
// JingleError.fromString("unsupported-info").toXML().toString()); JingleError.fromString("unsupported-info").toXML().toString());
assertEquals("unknown-session", JingleError.fromString("unknown-session").getMessage()); assertEquals("unknown-session", JingleError.fromString("unknown-session").getMessage());
try { try {