1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
23 import java.util.Properties;
24
25 /***
26 * Test case for the {@link AppletConfiguration} class.
27 *
28 * @author Emmanuel Bourg
29 * @version $Revision$, $Date: 2005-02-26 13:56:39 +0100 (Sat, 26 Feb 2005) $
30 */
31 public class TestAppletConfiguration extends TestAbstractConfiguration
32 {
33 protected AbstractConfiguration getConfiguration()
34 {
35 final Properties parameters = new Properties();
36 parameters.setProperty("key1", "value1");
37 parameters.setProperty("key2", "value2");
38 parameters.setProperty("list", "value1, value2");
39
40 Applet applet = new Applet()
41 {
42 public String getParameter(String key)
43 {
44 return parameters.getProperty(key);
45 }
46
47 public String[][] getParameterInfo()
48 {
49 return new String[][]
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());
64 }
65
66 public void testAddPropertyDirect()
67 {
68 try
69 {
70 super.testAddPropertyDirect();
71 fail("addPropertyDirect should throw an UnsupportedException");
72 }
73 catch (UnsupportedOperationException e)
74 {
75
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 e)
87 {
88
89 }
90 }
91 }