/** * * 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.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()); } @Test(expected = NullPointerException.class) public void alternativeSessionEmptyStringTest() { // Alternative sessionID must not be empty JingleReason.AlternativeSession(""); } @Test(expected = NullPointerException.class) public void alternativeSessionNullStringTest() { // Alternative sessionID must not be null JingleReason.AlternativeSession(null); } @Test(expected = IllegalArgumentException.class) public void illegalArgumentTest() { JingleReason.Reason.fromString("illegal-reason"); } }