KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > idaremedia > antx > testsmodule > tasks > BuildInfoTest


1 /**
2  * $Id: BuildInfoTest.java 180 2007-03-15 12:56:38Z ssmc $
3  * Copyright 2003 iDare Media, Inc. All rights reserved.
4  *
5  * Originally written by iDare Media, Inc. for release into the public domain. This
6  * library, source form and binary form, is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2 of the License, or (at your option) any later
9  * version.<p>
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU LGPL (GNU Lesser General Public License) for more details.<p>
14  *
15  * You should have received a copy of the GNU Lesser General Public License along with this
16  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
17  * 330, Boston, MA 02111-1307 USA. The LGPL can be found online at
18  * http://www.fsf.org/copyleft/lesser.html
19  *
20  * This product has been influenced by several projects within the open-source community.
21  * The JWare developers wish to acknowledge the open-source community's support. For more
22  * information regarding the open-source products used within JWare, please visit the
23  * JWare website.
24  *----------------------------------------------------------------------------------------*
25  * WEBSITE- http://www.jware.info EMAIL- inquiries@jware.info
26  *----------------------------------------------------------------------------------------*
27  **/

28
29 package com.idaremedia.antx.testsmodule.tasks;
30
31 import junit.framework.TestSuite;
32
33 import com.idaremedia.antx.ut.HTC;
34 import com.idaremedia.antx.ut.HTCUtils;
35 import com.idaremedia.apis.Buildstrs;
36
37 import com.idaremedia.antx.BuildInfo;
38
39 /**
40  * Unit test for <i>JWare/AntX</i> definition of its default {@linkplain Buildstrs}.
41  *
42  * @since JWare/AntX 0.2
43  * @author ssmc, &copy;2003 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
44  * @version 0.5
45  * @.safety single
46  * @.group impl,test
47  * @see com.idaremedia.apis.Buildstrs
48  **/

49
50 public final class BuildInfoTest extends HTC
51 {
52     private Buildstrs m_dynCopy;
53
54
55     /** <i>PET</i> Test Category. **/
56     public static final String JavaDoc TEST_CATEGORY="CLASS";
57
58
59     /**
60      * Initializes new unit test case.
61      **/

62     public BuildInfoTest(String JavaDoc methodName)
63     {
64         super("AntX::BuildInfo::",methodName);
65     }
66
67
68     /**
69      * Creates a full test suite for this Test class.
70      **/

71     public static TestSuite suite()
72     {
73         return new TestSuite(BuildInfoTest.class);
74     }
75
76
77     /**
78      * Create baseline test suite for BuildInfo (same as full).
79      **/

80     public static TestSuite baseline()
81     {
82         return suite();
83     }
84
85
86     /**
87      * Make this test (standalone) self-running.
88      **/

89     public static void main(String JavaDoc[] argv)
90     {
91         HTCUtils.quickCheck(suite());
92     }
93
94
95     /**
96      * Verifies you can extract a shared copy of buildstrs and
97      * clone existing instances.
98      **/

99     public void testCanonicalAPI()
100     {
101         assertEqual(m_dynCopy,BuildInfo.getInstance());
102         Object JavaDoc copy= ((BuildInfo)BuildInfo.getInstance()).clone();
103         assertNotIdent(copy,m_dynCopy);
104         assertEqual(copy,m_dynCopy);
105     }
106
107
108     /**
109      * Verifies that there is a string for each element (for some
110      * fields, method verifies that string is not empty and|or just
111      * whitespace).
112      **/

113     public void testAllStringsDefined()
114     {
115         assertEqual(m_dynCopy.getID(),"AntX");
116         assertNotNil(m_dynCopy.getDisplayName(),"displayName");
117         assertNotWhitespace(m_dynCopy.getVersion(),"version defined");
118         assertNotWhitespace(m_dynCopy.getBuildVersion(),"build-version defined");
119
120         assertNotNil(m_dynCopy.getNSPrefix(),"NS_Prefix");
121         assertNotNil(m_dynCopy.getNSURI(),"NS_URI");
122         assertNotNil(m_dynCopy.getPropertiesPrefix(),"Properties_Prefix");
123
124         assertNotWhitespace(m_dynCopy.getAbbrDate(),"abbrDate defined");
125         assertNotNil(m_dynCopy.getLongDate(),"longDate");
126
127         assertNotNil(m_dynCopy.getOS(),"OS");
128         assertNotNil(m_dynCopy.getBuilderID(),"builderID");
129         assertNotNil(m_dynCopy.getBuilderCN(),"builderCN");
130         assertNotNil(m_dynCopy.getHostID(),"hostID");
131
132         assertNotNil(m_dynCopy.getUsedPaths(),"usedPaths");
133     }
134
135
136     /**
137      * Dynamically create a reuseable BuildInfo instance.
138      **/

139     protected void setUp()
140     {
141         m_dynCopy= new BuildInfo();
142     }
143
144
145     /**
146      * Zero-out member fields for garbage-collecting.
147      **/

148     protected void tearDown()
149     {
150         m_dynCopy= null;
151     }
152 }
153
154 /* end-of-BuildInfoTest.java */
155
Popular Tags