001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: package javax.microedition.sip;
028:
029: import com.sun.midp.i3test.TestCase;
030: import gov.nist.siplite.header.*;
031:
032: /**
033: * Test for support of multiline header values.
034: */
035: public class TestMultilineHeaders extends SipHeaderBaseTest {
036:
037: /**
038: * Body of the test 1: support of multiline header values.
039: */
040: void Test1() {
041: SipHeader sh;
042:
043: // Header's name / header's value to set / expected return value
044: String[][] strHeaders = {
045: {
046: "Subject",
047: "I know you're there,\r\n"
048: + "\tpick up the phone and talk to me!",
049: "I know you're there, pick up the phone and talk to me!" },
050:
051: {
052: "Subject",
053: "I know you're there,\r\n"
054: + " pick up the phone and talk to me!",
055: "I know you're there, pick up the phone and talk to me!" },
056:
057: {
058: "Subject",
059: "I know you're there,\r\n"
060: + " pick up the phone and talk to me!",
061: "I know you're there, pick up "
062: + "the phone and talk to me!" },
063:
064: {
065: "Subject",
066: "I know you're there,\n\r"
067: + "\tpick up the phone and talk to me!",
068: "I know you're there, pick up the phone and talk to me!" },
069:
070: {
071: "Subject",
072: "I know you're there,\n"
073: + "\tpick up the phone and talk to me!",
074: "I know you're there, pick up the phone and talk to me!" },
075:
076: {
077: "Subject",
078: "I know you're there,\r"
079: + "\tpick up the phone and talk to me!",
080: "I know you're there, pick up the phone and talk to me!" },
081:
082: { "Organization", "Sun \n" + " Microsystems",
083: "Sun Microsystems" },
084:
085: {
086: "AnExtendedHeader",
087: "I know you're there,\r\n"
088: + " pick up the phone and talk to me!",
089: "I know you're there, pick up the phone and talk to me!" }, };
090:
091: for (int i = 0; i < strHeaders.length; i++) {
092: sh = createSipHeader(strHeaders[i][0], strHeaders[i][1]);
093:
094: if (sh == null) {
095: return;
096: }
097:
098: String val = sh.getValue();
099: assertEquals("Invalid header's value!", strHeaders[i][2],
100: val);
101: } // end for
102: }
103:
104: /**
105: * Run the tests.
106: */
107: public void runTests() {
108: declare("Test for support of multiline header values");
109: Test1();
110: }
111: }
|