FileDocCategorySizeDatePackage
TestParameterLessHeader.javaAPI DocphoneME MR2 API (J2ME)3592Wed May 02 18:00:40 BST 2007javax.microedition.sip

TestParameterLessHeader

public class TestParameterLessHeader extends SipHeaderBaseTest
This class is used to test TestParameterLessHeader class.

Fields Summary
private static final String[]
parameterLessHeaders
Array of the headers that can not have any parameters. See Header.java.
Constructors Summary
Methods Summary
voidTest1()
Body of the test 1. Test for "parameter-less" headers.


                  
      
        SipHeader sh;
        String    headerName;

        for (int i = 0; i < parameterLessHeaders.length; i++) {
            headerName = parameterLessHeaders[i];

            sh = createSipHeader(headerName, "INVITE;test=10");
            assertTrue("Cannot create '" + headerName + "' header!",
                       sh != null);

            // Ensure that the header was not parsed
            assertTrue("Header '" + headerName + "' was parsed!",
                       sh.getValue().equals(sh.getHeaderValue()));

            String[] paramNames = sh.getParameterNames();
            assertTrue("'" + headerName + "' header must not have " +
                       "any parameters!", paramNames == null);

            String param = sh.getParameter("test");
            assertTrue("'" + headerName + "' header has not parameter 'test'!",
                       param == null);

            try {
                sh.setParameter("test", "1");
                fail("IAE was not thrown!");
            } catch (IllegalArgumentException iae) {
                // System.out.println(headerName + " OK!");
            } catch (Exception e) {
                fail("Exception was caught: " + e);
            }
        } // end for()
    
public voidrunTests()
Run the tests

        declare("ParameterLessHeader class test");
        Test1();