KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > configuration > web > TestAppletConfiguration


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License")
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.commons.configuration.web;
18
19 import org.apache.commons.configuration.AbstractConfiguration;
20 import org.apache.commons.configuration.TestAbstractConfiguration;
21
22 import java.applet.Applet JavaDoc;
23 import java.util.Properties JavaDoc;
24
25 /**
26  * Test case for the {@link AppletConfiguration} class.
27  *
28  * @author Emmanuel Bourg
29  * @version $Revision: 155408 $, $Date: 2005-02-26 13:56:39 +0100 (Sa, 26 Feb 2005) $
30  */

31 public class TestAppletConfiguration extends TestAbstractConfiguration
32 {
33     protected AbstractConfiguration getConfiguration()
34     {
35         final Properties JavaDoc parameters = new Properties JavaDoc();
36         parameters.setProperty("key1", "value1");
37         parameters.setProperty("key2", "value2");
38         parameters.setProperty("list", "value1, value2");
39
40         Applet JavaDoc applet = new Applet JavaDoc()
41         {
42             public String JavaDoc getParameter(String JavaDoc key)
43             {
44                 return parameters.getProperty(key);
45             }
46
47             public String JavaDoc[][] getParameterInfo()
48             {
49                 return new String JavaDoc[][]
50                 {
51                     {"key1", "String", ""},
52                     {"key2", "String", ""},
53                     {"list", "String[]", ""}
54                 };
55             }
56         };
57
58         return new AppletConfiguration(applet);
59     }
60
61     protected AbstractConfiguration getEmptyConfiguration()
62     {
63         return new AppletConfiguration(new Applet JavaDoc());
64     }
65
66     public void testAddPropertyDirect()
67     {
68         try
69         {
70             super.testAddPropertyDirect();
71             fail("addPropertyDirect should throw an UnsupportedException");
72         }
73         catch (UnsupportedOperationException JavaDoc e)
74         {
75             // ok
76
}
77     }
78
79     public void testClearProperty()
80     {
81         try
82         {
83             super.testClearProperty();
84             fail("testClearProperty should throw an UnsupportedException");
85         }
86         catch (UnsupportedOperationException JavaDoc e)
87         {
88             // ok
89
}
90     }
91 }
92
Popular Tags