1 package org.apache.fulcrum.configuration;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.avalon.framework.component.ComponentException;
22 import org.apache.fulcrum.testcontainer.BaseUnitTest;
23 import org.apache.commons.configuration.Configuration;
24
25 /***
26 * Basic testing of the Container
27 *
28 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
29 * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
30 * @version $Id: ConfigTest.java 535465 2007-05-05 06:58:06Z tv $
31 */
32 public class ConfigTest extends BaseUnitTest
33 {
34 private Configuration config = null;
35
36 /***
37 * Constructor for test.
38 *
39 * @param testName name of the test being executed
40 */
41 public ConfigTest(String name)
42 {
43 super( name );
44 }
45
46 public void setUp() throws Exception
47 {
48 super.setUp();
49 try
50 {
51 config = (Configuration) this.resolve( Configuration.class.getName() );
52
53 }
54 catch (ComponentException e)
55 {
56 e.printStackTrace();
57 fail(e.getMessage());
58 }
59 }
60
61 /***
62 * Verifies that the ConfigurationFactory works properly.
63 *
64 */
65 public void testLoad()
66 {
67 assertEquals(10.25,config.getDouble("test.double"),0);
68 assertEquals(
69 "I'm complex!",config.getString("element2.subelement.subsubelement"));
70 }
71
72 }