KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > torque > avalon > AvalonTest


1 package org.apache.torque.avalon;
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
24 /**
25  * Basic testing of the Torque Avalon Component
26  *
27  * @author <a HREF="mailto:tv@apache.org">Thomas Vandahl</a>
28  * @version $Id:$
29  */

30 public class AvalonTest extends BaseUnitTest
31 {
32     private Torque torque = null;
33
34     /**
35      * Constructor for test.
36      *
37      * @param testName name of the test being executed
38      */

39     public AvalonTest(String JavaDoc name)
40     {
41         super( name );
42     }
43
44     public void setUp() throws Exception JavaDoc
45     {
46         super.setUp();
47         try
48         {
49             torque = (Torque) this.resolve( Torque.class.getName() );
50         }
51         catch (ComponentException e)
52         {
53             e.printStackTrace();
54             fail(e.getMessage());
55         }
56     }
57
58     /**
59      * Verifies that the container initialization and lookup works properly.
60      */

61     public void testAvalon()
62     {
63         assertTrue(torque.isInit());
64         assertTrue("Instances should be identical", torque == org.apache.torque.Torque.getInstance());
65     }
66 }
67
Popular Tags