/**
*
* Copyright 2017 Paul Schaub
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.smackx.jingle.element.JingleReason;
import org.junit.Test;
/**
* Test JingleReason functionality.
*/
public class JingleReasonTest extends SmackTestSuite {
@Test
public void parserTest() {
assertEquals("",
JingleReason.Success.toXML().toString());
assertEquals("",
JingleReason.Busy.toXML().toString());
assertEquals("",
JingleReason.Cancel.toXML().toString());
assertEquals("",
JingleReason.ConnectivityError.toXML().toString());
assertEquals("",
JingleReason.Decline.toXML().toString());
assertEquals("",
JingleReason.Expired.toXML().toString());
assertEquals("",
JingleReason.UnsupportedTransports.toXML().toString());
assertEquals("",
JingleReason.FailedTransport.toXML().toString());
assertEquals("",
JingleReason.GeneralError.toXML().toString());
assertEquals("",
JingleReason.Gone.toXML().toString());
assertEquals("",
JingleReason.MediaError.toXML().toString());
assertEquals("",
JingleReason.SecurityError.toXML().toString());
assertEquals("",
JingleReason.UnsupportedApplications.toXML().toString());
assertEquals("",
JingleReason.Timeout.toXML().toString());
assertEquals("",
JingleReason.FailedApplication.toXML().toString());
assertEquals("",
JingleReason.IncompatibleParameters.toXML().toString());
assertEquals("1234",
JingleReason.AlternativeSession("1234").toXML().toString());
// Alternative sessionID must not be empty
try {
JingleReason.AlternativeSession("");
fail();
} catch (NullPointerException e) {
// Expected
}
// Alternative sessionID must not be null
try {
JingleReason.AlternativeSession(null);
fail();
} catch (NullPointerException e) {
// Expected
}
try {
JingleReason.Reason nonExistent = JingleReason.Reason.fromString("illegal-reason");
fail();
} catch (IllegalArgumentException e) {
// Expected
}
}
}