1   package org.apache.fulcrum.configuration;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
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  }