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 javax.servlet.Servlet;
20 import javax.servlet.ServletConfig;
21 import javax.servlet.http.HttpServlet;
22
23 import com.mockobjects.servlet.MockServletConfig;
24 import org.apache.commons.configuration.AbstractConfiguration;
25 import org.apache.commons.configuration.TestAbstractConfiguration;
26
27 /***
28 * Test case for the {@link ServletConfiguration} class.
29 *
30 * @author Emmanuel Bourg
31 * @version $Revision$, $Date: 2005-02-26 13:56:39 +0100 (Sat, 26 Feb 2005) $
32 */
33 public class TestServletConfiguration extends TestAbstractConfiguration
34 {
35 protected AbstractConfiguration getConfiguration()
36 {
37 final MockServletConfig config = new MockServletConfig();
38 config.setInitParameter("key1", "value1");
39 config.setInitParameter("key2", "value2");
40 config.setInitParameter("list", "value1, value2");
41
42 Servlet servlet = new HttpServlet() {
43 public ServletConfig getServletConfig()
44 {
45 return config;
46 }
47 };
48
49 return new ServletConfiguration(servlet);
50 }
51
52 protected AbstractConfiguration getEmptyConfiguration()
53 {
54 return new ServletConfiguration(new MockServletConfig());
55 }
56
57 public void testAddPropertyDirect()
58 {
59 try
60 {
61 super.testAddPropertyDirect();
62 fail("addPropertyDirect should throw an UnsupportedException");
63 }
64 catch (UnsupportedOperationException e)
65 {
66
67 }
68 }
69
70 public void testClearProperty()
71 {
72 try
73 {
74 super.testClearProperty();
75 fail("testClearProperty should throw an UnsupportedException");
76 }
77 catch (UnsupportedOperationException e)
78 {
79
80 }
81 }
82
83 }