/** * * 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(null).toString()); assertEquals("", JingleReasonElement.Busy.toXML(null).toString()); assertEquals("", JingleReasonElement.Cancel.toXML(null).toString()); assertEquals("", JingleReasonElement.ConnectivityError.toXML(null).toString()); assertEquals("", JingleReasonElement.Decline.toXML(null).toString()); assertEquals("", JingleReasonElement.Expired.toXML(null).toString()); assertEquals("", JingleReasonElement.UnsupportedTransports.toXML(null).toString()); assertEquals("", JingleReasonElement.FailedTransport.toXML(null).toString()); assertEquals("", JingleReasonElement.GeneralError.toXML(null).toString()); assertEquals("", JingleReasonElement.Gone.toXML(null).toString()); assertEquals("", JingleReasonElement.MediaError.toXML(null).toString()); assertEquals("", JingleReasonElement.SecurityError.toXML(null).toString()); assertEquals("", JingleReasonElement.UnsupportedApplications.toXML(null).toString()); assertEquals("", JingleReasonElement.Timeout.toXML(null).toString()); assertEquals("", JingleReasonElement.FailedApplication.toXML(null).toString()); assertEquals("", JingleReasonElement.IncompatibleParameters.toXML(null).toString()); assertEquals("1234", JingleReasonElement.AlternativeSession("1234").toXML(null).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"); } }