javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/alert/AlertTest.java
changeset 23 98ccebc37403
parent 21 2a9601315dfc
child 72 1f0034e370aa
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 package com.nokia.openlcdui.mt.alert;
    17 package com.nokia.openlcdui.mt.alert;
    18 
    18 
    19 import junit.framework.*;
    19 import junit.framework.*;
    28  * <br>
    28  * <br>
    29  * Short description of the module test:
    29  * Short description of the module test:
    30  * <li>Collection of tests to test Alert's API functionality. <br>
    30  * <li>Collection of tests to test Alert's API functionality. <br>
    31  * <br>
    31  * <br>
    32  */
    32  */
    33 public class AlertTest extends SWTTestCase {
    33 public class AlertTest extends SWTTestCase
       
    34 {
    34 
    35 
    35     private static String shortString = "Lorem ipsum";
    36     private static String shortString = "Lorem ipsum";
    36 
    37 
    37     private static String longString = "Lorem ipsum dolor sit amet, "
    38     private static String longString = "Lorem ipsum dolor sit amet, "
    38             + "consectetuer adipiscing elit. Cras turpis ligula, "
    39                                        + "consectetuer adipiscing elit. Cras turpis ligula, "
    39             + "condimentum nec, rhoncus quis, molestie in, arcu. "
    40                                        + "condimentum nec, rhoncus quis, molestie in, arcu. "
    40             + "Curabitur id lacus. Quisque dictum nulla id odio. "
    41                                        + "Curabitur id lacus. Quisque dictum nulla id odio. "
    41             + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    42                                        + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    42             + " Integer ut eros. Proin laoreet justo et augue. "
    43                                        + " Integer ut eros. Proin laoreet justo et augue. "
    43             + "Praesent dui. Proin vel leo a eros auctor convallis. "
    44                                        + "Praesent dui. Proin vel leo a eros auctor convallis. "
    44             + "Aenean urna nunc, sagittis vel, pellentesque a, "
    45                                        + "Aenean urna nunc, sagittis vel, pellentesque a, "
    45             + "luctus a, metus. Phasellus posuere lacus nec augue."
    46                                        + "luctus a, metus. Phasellus posuere lacus nec augue."
    46             + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    47                                        + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    47             + " Integer ut eros. Proin laoreet justo et augue. "
    48                                        + " Integer ut eros. Proin laoreet justo et augue. "
    48             + "Praesent dui. Proin vel leo a eros auctor convallis. "
    49                                        + "Praesent dui. Proin vel leo a eros auctor convallis. "
    49             + "Aenean urna nunc, sagittis vel, pellentesque a, "
    50                                        + "Aenean urna nunc, sagittis vel, pellentesque a, "
    50             + "luctus a, metus. Phasellus posuere lacus nec augue."
    51                                        + "luctus a, metus. Phasellus posuere lacus nec augue."
    51             + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    52                                        + "Nullam nec urna. Cras ac lacus nec lacus iaculis aliquet."
    52             + " Integer ut eros. Proin laoreet justo et augue. "
    53                                        + " Integer ut eros. Proin laoreet justo et augue. "
    53             + "Praesent dui. Proin vel leo a eros auctor convallis. "
    54                                        + "Praesent dui. Proin vel leo a eros auctor convallis. "
    54             + "Aenean urna nunc, sagittis vel, pellentesque a, "
    55                                        + "Aenean urna nunc, sagittis vel, pellentesque a, "
    55             + "luctus a, metus. Phasellus posuere lacus nec augue.";
    56                                        + "luctus a, metus. Phasellus posuere lacus nec augue.";
    56 
    57 
    57 
    58 
    58     private static final int INVALID_ALERT_TIMEOUT = -3000;
    59     private static final int INVALID_ALERT_TIMEOUT = -3000;
    59     private static final int VALID_ALERT_TIMEOUT = 2000;
    60     private static final int VALID_ALERT_TIMEOUT = 2000;
    60 
    61 
    61 
    62 
    62     /**
    63     /**
    63      * Constructor.
    64      * Constructor.
    64      */
    65      */
    65     public AlertTest() {
    66     public AlertTest()
       
    67     {
    66     }
    68     }
    67 
    69 
    68     /**
    70     /**
    69      * Constructor.
    71      * Constructor.
    70      *
    72      *
    71      * @param sTestName Test name.
    73      * @param sTestName Test name.
    72      * @param rTestMethod Test method.
    74      * @param rTestMethod Test method.
    73      */
    75      */
    74     public AlertTest(String sTestName) {
    76     public AlertTest(String sTestName)
       
    77     {
    75         super(sTestName);
    78         super(sTestName);
    76     }
    79     }
    77 
    80 
    78     /**
    81     /**
    79      * To create the test suite. You need to add a new aSuite.addTest entry for
    82      * To create the test suite. You need to add a new aSuite.addTest entry for
    80      * any new test methods.
    83      * any new test methods.
    81      *
    84      *
    82      * @return New testsuite.
    85      * @return New testsuite.
    83      */
    86      */
    84     public static Test suite() {
    87     public static Test suite()
       
    88     {
    85         TestSuite suite = new TestSuite();
    89         TestSuite suite = new TestSuite();
    86 
    90 
    87         java.util.Vector methodNames;
    91         java.util.Vector methodNames;
    88 	    java.util.Enumeration e;
    92         java.util.Enumeration e;
    89 
    93 
    90 	    // Add widget tests
    94         // Add widget tests
    91 	    methodNames = AlertTest.methodNames();
    95         methodNames = AlertTest.methodNames();
    92 	    e = methodNames.elements();
    96         e = methodNames.elements();
    93 	    while (e.hasMoreElements()) {
    97         while(e.hasMoreElements())
    94 	        suite.addTest(new AlertTest((String)e.nextElement()));
    98         {
    95 	    }
    99             suite.addTest(new AlertTest((String)e.nextElement()));
    96         
   100         }
       
   101 
    97         return suite;
   102         return suite;
    98     }
   103     }
    99 
   104 
   100     public static java.util.Vector methodNames() {
   105     public static java.util.Vector methodNames()
       
   106     {
   101         java.util.Vector methodNames = new java.util.Vector();
   107         java.util.Vector methodNames = new java.util.Vector();
   102         methodNames.addElement("testConstructors");
   108         methodNames.addElement("testConstructors");
   103         methodNames.addElement("testSetGetTimeout");
   109         methodNames.addElement("testSetGetTimeout");
   104         methodNames.addElement("testSetGetType");
   110         methodNames.addElement("testSetGetType");
   105         methodNames.addElement("testSetGetImage");
   111         methodNames.addElement("testSetGetImage");
   106         methodNames.addElement("testSetGetTexts");
   112         methodNames.addElement("testSetGetTexts");
   107         methodNames.addElement("testSetGetIndicators");
   113         methodNames.addElement("testSetGetIndicators");
   108         methodNames.addElement("testCommands");
   114         methodNames.addElement("testCommands");
   109         return methodNames;
   115         return methodNames;
   110     }
   116     }
   111     
   117 
   112     protected void runTest() throws Throwable {
   118     protected void runTest() throws Throwable
   113         if (getName().equals("testConstructors")) testConstructors();
   119     {
   114         else if (getName().equals("testSetGetTimeout")) testSetGetTimeout();
   120         if(getName().equals("testConstructors")) testConstructors();
   115         else if (getName().equals("testSetGetType")) testSetGetType();
   121         else if(getName().equals("testSetGetTimeout")) testSetGetTimeout();
   116         else if (getName().equals("testSetGetImage")) testSetGetImage();
   122         else if(getName().equals("testSetGetType")) testSetGetType();
   117         else if (getName().equals("testSetGetTexts")) testSetGetTexts();
   123         else if(getName().equals("testSetGetImage")) testSetGetImage();
   118         else if (getName().equals("testSetGetIndicators")) testSetGetIndicators();
   124         else if(getName().equals("testSetGetTexts")) testSetGetTexts();
   119         else if (getName().equals("testCommands")) testCommands();
   125         else if(getName().equals("testSetGetIndicators")) testSetGetIndicators();
       
   126         else if(getName().equals("testCommands")) testCommands();
   120         else super.runTest();
   127         else super.runTest();
   121     }    
   128     }
   122     
   129 
   123     /**
   130     /**
   124      * Tests the constructors.
   131      * Tests the constructors.
   125      */
   132      */
   126     public void testConstructors() {
   133     public void testConstructors()
   127         try {
   134     {
       
   135         try
       
   136         {
   128             new Alert(null);
   137             new Alert(null);
   129         }
   138         }
   130         catch (Exception e) {
   139         catch(Exception e)
       
   140         {
   131             fail("Exception - Constructor with null title - " + e.getMessage());
   141             fail("Exception - Constructor with null title - " + e.getMessage());
   132         }
   142         }
   133 
   143 
   134         try {
   144         try
       
   145         {
   135             new Alert(shortString);
   146             new Alert(shortString);
   136         }
   147         }
   137         catch (Exception e) {
   148         catch(Exception e)
       
   149         {
   138             fail("Exception - Constructor with short text - " + e.getMessage());
   150             fail("Exception - Constructor with short text - " + e.getMessage());
   139         }
   151         }
   140 
   152 
   141         try {
   153         try
       
   154         {
   142             new Alert(shortString, longString, null, null);
   155             new Alert(shortString, longString, null, null);
   143         }
   156         }
   144         catch (Exception e) {
   157         catch(Exception e)
       
   158         {
   145             fail("Exception - Constructor with long text - " + e.getMessage());
   159             fail("Exception - Constructor with long text - " + e.getMessage());
   146         }
   160         }
   147     }
   161     }
   148 
   162 
   149     /**
   163     /**
   150      * Tests setter and getter t.
   164      * Tests setter and getter t.
   151      */
   165      */
   152     public void testSetGetTimeout() {
   166     public void testSetGetTimeout()
       
   167     {
   153         Alert alert = new Alert(shortString);
   168         Alert alert = new Alert(shortString);
   154         alert.setTimeout(VALID_ALERT_TIMEOUT);
   169         alert.setTimeout(VALID_ALERT_TIMEOUT);
   155         assertEquals("Timeouts don't match.", VALID_ALERT_TIMEOUT, alert
   170         assertEquals("Timeouts don't match.", VALID_ALERT_TIMEOUT, alert
   156                 .getTimeout());
   171                      .getTimeout());
   157         alert.setTimeout(Alert.FOREVER);
   172         alert.setTimeout(Alert.FOREVER);
   158         assertEquals("Timeouts don't match.", Alert.FOREVER, alert.getTimeout());
   173         assertEquals("Timeouts don't match.", Alert.FOREVER, alert.getTimeout());
   159         try {
   174         try
       
   175         {
   160             alert.setTimeout(INVALID_ALERT_TIMEOUT);
   176             alert.setTimeout(INVALID_ALERT_TIMEOUT);
   161             fail("IllegalArgumentException should be thrown");
   177             fail("IllegalArgumentException should be thrown");
   162         }
   178         }
   163         catch (IllegalArgumentException iae) {
   179         catch(IllegalArgumentException iae)
       
   180         {
   164             // OK
   181             // OK
   165         }
   182         }
   166     }
   183     }
   167 
   184 
   168     /**
   185     /**
   169      * Tests set and get type.
   186      * Tests set and get type.
   170      */
   187      */
   171     public void testSetGetType() {
   188     public void testSetGetType()
       
   189     {
   172         Alert alert = new Alert(shortString);
   190         Alert alert = new Alert(shortString);
   173 
   191 
   174         alert.setType(AlertType.ALARM);
   192         alert.setType(AlertType.ALARM);
   175         assertEquals("Types don't match.", AlertType.ALARM, alert.getType());
   193         assertEquals("Types don't match.", AlertType.ALARM, alert.getType());
   176 
   194 
   177         alert.setType(AlertType.CONFIRMATION);
   195         alert.setType(AlertType.CONFIRMATION);
   178         assertEquals("Types don't match.", AlertType.CONFIRMATION, alert
   196         assertEquals("Types don't match.", AlertType.CONFIRMATION, alert
   179                 .getType());
   197                      .getType());
   180 
   198 
   181         alert.setType(AlertType.ERROR);
   199         alert.setType(AlertType.ERROR);
   182         assertEquals("Types don't match.", AlertType.ERROR, alert.getType());
   200         assertEquals("Types don't match.", AlertType.ERROR, alert.getType());
   183 
   201 
   184         alert.setType(AlertType.INFO);
   202         alert.setType(AlertType.INFO);
   189     }
   207     }
   190 
   208 
   191     /**
   209     /**
   192      * Tests set and get image.
   210      * Tests set and get image.
   193      */
   211      */
   194     public void testSetGetImage() {
   212     public void testSetGetImage()
   195         try {
   213     {
       
   214         try
       
   215         {
   196             Alert alert = new Alert(shortString);
   216             Alert alert = new Alert(shortString);
   197             alert.setImage(null);
   217             alert.setImage(null);
   198             assertEquals("Images don't match.", null, alert.getImage());
   218             assertEquals("Images don't match.", null, alert.getImage());
   199 
   219 
   200             Image param = Image.createImage("100x100.png");
   220             Image param = Image.createImage("100x100.png");
   201             alert.setImage(param);
   221             alert.setImage(param);
   202             assertEquals("Images don't match.", param, alert.getImage());
   222             assertEquals("Images don't match.", param, alert.getImage());
   203         }
   223         }
   204         catch (IOException e) {
   224         catch(IOException e)
       
   225         {
   205             fail("Cannot load image 100x100.png");
   226             fail("Cannot load image 100x100.png");
   206         }
   227         }
   207     }
   228     }
   208 
   229 
   209     /**
   230     /**
   210      * Tests set and get texts.
   231      * Tests set and get texts.
   211      */
   232      */
   212     public void testSetGetTexts() {
   233     public void testSetGetTexts()
       
   234     {
   213         Alert alert = new Alert(shortString);
   235         Alert alert = new Alert(shortString);
   214         alert.setString(null);
   236         alert.setString(null);
   215         assertEquals("String don't match.", null, alert.getString());
   237         assertEquals("String don't match.", null, alert.getString());
   216 
   238 
   217         alert.setString(shortString);
   239         alert.setString(shortString);
   218         assertEquals("Strings dont match.", shortString, alert.getString());
   240         assertEquals("Strings dont match.", shortString, alert.getString());
   219         assertTrue("Alert with short text is modal",
   241         assertTrue("Alert with short text is modal",
   220                 alert.getTimeout() != Alert.FOREVER);
   242                    alert.getTimeout() != Alert.FOREVER);
   221 
   243 
   222         alert.setString(longString);
   244         alert.setString(longString);
   223         assertEquals("Strings dont match", longString, alert.getString());
   245         assertEquals("Strings dont match", longString, alert.getString());
   224         assertTrue("Alert with long text is not modal",
   246         assertTrue("Alert with long text is not modal",
   225                 alert.getTimeout() == Alert.FOREVER);
   247                    alert.getTimeout() == Alert.FOREVER);
   226     }
   248     }
   227 
   249 
   228     /**
   250     /**
   229      * Tests set and get indicator methods and Gauge-Alert interaction related
   251      * Tests set and get indicator methods and Gauge-Alert interaction related
   230      * Item methods.
   252      * Item methods.
   231      */
   253      */
   232     public void testSetGetIndicators() {
   254     public void testSetGetIndicators()
       
   255     {
   233         Alert alert = new Alert(shortString);
   256         Alert alert = new Alert(shortString);
   234         Gauge param1 = new Gauge(null, false, 10, 0);
   257         Gauge param1 = new Gauge(null, false, 10, 0);
   235         alert.setIndicator(param1);
   258         alert.setIndicator(param1);
   236         assertEquals("Indicators don't match.", param1, alert.getIndicator());
   259         assertEquals("Indicators don't match.", param1, alert.getIndicator());
   237 
   260 
   238         try {
   261         try
       
   262         {
   239             Gauge param2 = new Gauge("Label", true, 10, 0);
   263             Gauge param2 = new Gauge("Label", true, 10, 0);
   240             alert.setIndicator(param2);
   264             alert.setIndicator(param2);
   241             fail("1. IllegalArgumentException expected");
   265             fail("1. IllegalArgumentException expected");
   242         }
   266         }
   243         catch (IllegalArgumentException iae) {
   267         catch(IllegalArgumentException iae)
   244         }
   268         {
   245 
   269         }
   246         try {
   270 
       
   271         try
       
   272         {
   247             param1.addCommand(new Command("Comm1", Command.ITEM, 0));
   273             param1.addCommand(new Command("Comm1", Command.ITEM, 0));
   248             fail("2. IllegalStateException expected");
   274             fail("2. IllegalStateException expected");
   249         }
   275         }
   250         catch (IllegalStateException ise) {
   276         catch(IllegalStateException ise)
   251         }
   277         {
   252 
   278         }
   253         try {
   279 
       
   280         try
       
   281         {
   254             param1.setDefaultCommand(new Command("Comm1", Command.ITEM, 0));
   282             param1.setDefaultCommand(new Command("Comm1", Command.ITEM, 0));
   255             fail("3. IllegalStateException expected");
   283             fail("3. IllegalStateException expected");
   256         }
   284         }
   257         catch (IllegalStateException ise) {
   285         catch(IllegalStateException ise)
   258         }
   286         {
   259 
   287         }
   260         try {
   288 
   261             ItemCommandListener icl = new ItemCommandListener() {
   289         try
   262                 public void commandAction(Command command, Item item) {
   290         {
       
   291             ItemCommandListener icl = new ItemCommandListener()
       
   292             {
       
   293                 public void commandAction(Command command, Item item)
       
   294                 {
   263                 }
   295                 }
   264             };
   296             };
   265             param1.setItemCommandListener(icl);
   297             param1.setItemCommandListener(icl);
   266             fail("4. IllegalStateException expected");
   298             fail("4. IllegalStateException expected");
   267         }
   299         }
   268         catch (IllegalStateException ise) {
   300         catch(IllegalStateException ise)
   269         }
   301         {
   270 
   302         }
   271         try {
   303 
       
   304         try
       
   305         {
   272             param1.setLabel("Label");
   306             param1.setLabel("Label");
   273             fail("5. IllegalStateException expected");
   307             fail("5. IllegalStateException expected");
   274         }
   308         }
   275         catch (IllegalStateException ise) {
   309         catch(IllegalStateException ise)
   276         }
   310         {
   277 
   311         }
   278         try {
   312 
       
   313         try
       
   314         {
   279             param1.setLayout(Item.LAYOUT_BOTTOM);
   315             param1.setLayout(Item.LAYOUT_BOTTOM);
   280             fail("6. IllegalStateException expected");
   316             fail("6. IllegalStateException expected");
   281         }
   317         }
   282         catch (IllegalStateException ise) {
   318         catch(IllegalStateException ise)
   283         }
   319         {
   284 
   320         }
   285         try {
   321 
       
   322         try
       
   323         {
   286             param1.setPreferredSize(10, 10);
   324             param1.setPreferredSize(10, 10);
   287             fail("7. IllegalStateException expected");
   325             fail("7. IllegalStateException expected");
   288         }
   326         }
   289         catch (IllegalStateException ise) {
   327         catch(IllegalStateException ise)
       
   328         {
   290         }
   329         }
   291 
   330 
   292         alert.setIndicator(null);
   331         alert.setIndicator(null);
   293     }
   332     }
   294 
   333 
   295     /**
   334     /**
   296      * Tests commands on Alert.
   335      * Tests commands on Alert.
   297      */
   336      */
   298     public void testCommands() {
   337     public void testCommands()
   299         try {
   338     {
       
   339         try
       
   340         {
   300             Alert alert = new Alert(shortString);
   341             Alert alert = new Alert(shortString);
   301             CommandListener param = new CommandListener() {
   342             CommandListener param = new CommandListener()
   302                 public void commandAction(Command c, Displayable d) {
   343             {
       
   344                 public void commandAction(Command c, Displayable d)
       
   345                 {
   303                 }
   346                 }
   304             };
   347             };
   305             alert.setCommandListener(param);
   348             alert.setCommandListener(param);
   306             alert.setCommandListener(null);
   349             alert.setCommandListener(null);
   307         }
   350         }
   308         catch (Exception e) {
   351         catch(Exception e)
       
   352         {
   309             fail("Exception - Setting and removing CommandListener - "
   353             fail("Exception - Setting and removing CommandListener - "
   310                     + e.getMessage());
   354                  + e.getMessage());
   311         }
   355         }
   312 
   356 
   313         try {
   357         try
       
   358         {
   314             Alert alert = new Alert(shortString);
   359             Alert alert = new Alert(shortString);
   315             // adding null command
   360             // adding null command
   316             alert.addCommand(null);
   361             alert.addCommand(null);
   317             fail("NullPointerException expected - NULL command added to Alert");
   362             fail("NullPointerException expected - NULL command added to Alert");
   318         }
   363         }
   319         catch (NullPointerException npe) {
   364         catch(NullPointerException npe)
       
   365         {
   320             // Ok
   366             // Ok
   321         }
   367         }
   322         catch (Exception e) {
   368         catch(Exception e)
       
   369         {
   323             fail("Wrong exception is thrown instead of NullPointerException - "
   370             fail("Wrong exception is thrown instead of NullPointerException - "
   324                     + "NULL command added to Alert" + e.getMessage());
   371                  + "NULL command added to Alert" + e.getMessage());
   325         }
   372         }
   326 
   373 
   327         try {
   374         try
       
   375         {
   328             Alert alert = new Alert(shortString);
   376             Alert alert = new Alert(shortString);
   329 
   377 
   330             // test default command
   378             // test default command
   331             alert.addCommand(Alert.DISMISS_COMMAND);
   379             alert.addCommand(Alert.DISMISS_COMMAND);
   332             assertTrue("Default Alert shouldn't be modal",
   380             assertTrue("Default Alert shouldn't be modal",
   333                     alert.getTimeout() != Alert.FOREVER);
   381                        alert.getTimeout() != Alert.FOREVER);
   334             alert.removeCommand(Alert.DISMISS_COMMAND);
   382             alert.removeCommand(Alert.DISMISS_COMMAND);
   335 
   383 
   336             Command c1 = new Command("Comm1", Command.ITEM, 0);
   384             Command c1 = new Command("Comm1", Command.ITEM, 0);
   337             Command c2 = new Command("Comm2", Command.ITEM, 0);
   385             Command c2 = new Command("Comm2", Command.ITEM, 0);
   338             Command c3 = new Command("Comm3", Command.ITEM, 0);
   386             Command c3 = new Command("Comm3", Command.ITEM, 0);
   340             Command c5 = new Command("Comm5", Command.ITEM, 0);
   388             Command c5 = new Command("Comm5", Command.ITEM, 0);
   341 
   389 
   342             // add commands
   390             // add commands
   343             alert.addCommand(c1);
   391             alert.addCommand(c1);
   344             assertTrue("Default Alert with 1 command shouldn't be modal", alert
   392             assertTrue("Default Alert with 1 command shouldn't be modal", alert
   345                     .getTimeout() != Alert.FOREVER);
   393                        .getTimeout() != Alert.FOREVER);
   346             alert.addCommand(c2);
   394             alert.addCommand(c2);
   347             assertTrue("Default Alert with 2 commands should be modal", alert
   395             assertTrue("Default Alert with 2 commands should be modal", alert
   348                     .getTimeout() == Alert.FOREVER);
   396                        .getTimeout() == Alert.FOREVER);
   349             alert.addCommand(c3);
   397             alert.addCommand(c3);
   350             alert.addCommand(c4);
   398             alert.addCommand(c4);
   351             alert.addCommand(c5);
   399             alert.addCommand(c5);
   352             assertTrue("Default Alert with 5 commands should be modal", alert
   400             assertTrue("Default Alert with 5 commands should be modal", alert
   353                     .getTimeout() == Alert.FOREVER);
   401                        .getTimeout() == Alert.FOREVER);
   354 
   402 
   355             // remove commands
   403             // remove commands
   356             alert.removeCommand(c5);
   404             alert.removeCommand(c5);
   357             alert.removeCommand(c4);
   405             alert.removeCommand(c4);
   358             alert.removeCommand(c3);
   406             alert.removeCommand(c3);
   359             assertTrue("Default Alert with 2 commands should be modal", alert
   407             assertTrue("Default Alert with 2 commands should be modal", alert
   360                     .getTimeout() == Alert.FOREVER);
   408                        .getTimeout() == Alert.FOREVER);
   361             alert.removeCommand(c2);
   409             alert.removeCommand(c2);
   362             assertTrue("Default Alert with 1 command shouldn't be modal", alert
   410             assertTrue("Default Alert with 1 command shouldn't be modal", alert
   363                     .getTimeout() != Alert.FOREVER);
   411                        .getTimeout() != Alert.FOREVER);
   364             alert.removeCommand(c1);
   412             alert.removeCommand(c1);
   365             assertTrue("Default Alert shouldn't be modal",
   413             assertTrue("Default Alert shouldn't be modal",
   366                     alert.getTimeout() != Alert.FOREVER);
   414                        alert.getTimeout() != Alert.FOREVER);
   367         }
   415         }
   368         catch (Exception e) {
   416         catch(Exception e)
       
   417         {
   369             fail("Exception - Adding 5 commands - " + e.getMessage());
   418             fail("Exception - Adding 5 commands - " + e.getMessage());
   370         }
   419         }
   371     }
   420     }
   372 
   421 
   373 }
   422 }