KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > fortress > util > test > TestComponent


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.fortress.util.test;
19
20 import junit.framework.Assert;
21
22 /**
23  * TestComponent does XYZ
24  *
25  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
26  * @version CVS $ Revision: 1.1 $
27  */

28 public class TestComponent extends Assert
29 {
30     private boolean m_isCreated;
31     private boolean m_isDestroyed;
32     private boolean m_isAccessed;
33     private boolean m_isReleased;
34
35     public void create()
36     {
37         assertTrue( !m_isCreated);
38         assertTrue( !m_isAccessed );
39         assertTrue( !m_isReleased );
40         assertTrue( !m_isDestroyed );
41         m_isCreated = true;
42         assertTrue(m_isCreated);
43     }
44
45     public void access()
46     {
47         assertTrue( m_isCreated );
48         assertTrue( !m_isAccessed );
49         assertTrue( !m_isReleased );
50         assertTrue( !m_isDestroyed );
51         m_isAccessed = true;
52         assertTrue( m_isAccessed );
53     }
54
55     public void release()
56     {
57         assertTrue( m_isCreated );
58         assertTrue( m_isAccessed );
59         assertTrue( !m_isReleased );
60         assertTrue( !m_isDestroyed );
61         m_isReleased = true;
62         assertTrue( m_isReleased );
63     }
64
65     public void destroy()
66     {
67         assertTrue( m_isCreated );
68         assertTrue( m_isAccessed );
69         assertTrue( m_isReleased );
70         assertTrue( !m_isDestroyed );
71         m_isDestroyed = true;
72         assertTrue(m_isDestroyed);
73     }
74 }
75
Popular Tags