/**
*
* 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 org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smackx.jingle.element.JingleReasonElement;
import org.junit.Test;
/**
* Test JingleReason functionality.
*/
public class JingleReasonElementTest extends SmackTestSuite {
@Test
public void parserTest() {
assertEquals("",
JingleReasonElement.Success.toXML().toString());
assertEquals("",
JingleReasonElement.Busy.toXML().toString());
assertEquals("",
JingleReasonElement.Cancel.toXML().toString());
assertEquals("",
JingleReasonElement.ConnectivityError.toXML().toString());
assertEquals("",
JingleReasonElement.Decline.toXML().toString());
assertEquals("",
JingleReasonElement.Expired.toXML().toString());
assertEquals("",
JingleReasonElement.UnsupportedTransports.toXML().toString());
assertEquals("",
JingleReasonElement.FailedTransport.toXML().toString());
assertEquals("",
JingleReasonElement.GeneralError.toXML().toString());
assertEquals("",
JingleReasonElement.Gone.toXML().toString());
assertEquals("",
JingleReasonElement.MediaError.toXML().toString());
assertEquals("",
JingleReasonElement.SecurityError.toXML().toString());
assertEquals("",
JingleReasonElement.UnsupportedApplications.toXML().toString());
assertEquals("",
JingleReasonElement.Timeout.toXML().toString());
assertEquals("",
JingleReasonElement.FailedApplication.toXML().toString());
assertEquals("",
JingleReasonElement.IncompatibleParameters.toXML().toString());
assertEquals("1234",
JingleReasonElement.AlternativeSession("1234").toXML().toString());
}
@Test(expected = NullPointerException.class)
public void alternativeSessionEmptyStringTest() {
// Alternative sessionID must not be empty
JingleReasonElement.AlternativeSession("");
}
@Test(expected = NullPointerException.class)
public void alternativeSessionNullStringTest() {
// Alternative sessionID must not be null
JingleReasonElement.AlternativeSession(null);
}
@Test(expected = IllegalArgumentException.class)
public void illegalArgumentTest() {
JingleReasonElement.Reason.fromString("illegal-reason");
}
}