KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > codecoverage > v2 > report > XmlReportGeneratorUTest


1 /*
2  * @(#)XmlReportGeneratorUTest.java
3  *
4  * Copyright (C) 2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.codecoverage.v2.report;
28
29 import junit.framework.Test;
30 import junit.framework.TestCase;
31 import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
32 import net.sourceforge.groboutils.junit.v1.iftc.CxFactory;
33 import net.sourceforge.groboutils.junit.v1.iftc.InterfaceTestSuite;
34
35
36 /**
37  * Tests the XmlReportGenerator class.
38  *
39  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
40  * @version $Date: 2004/04/15 05:48:29 $
41  * @since January 22, 2003
42  */

43 public class XmlReportGeneratorUTest extends TestCase
44 {
45     //-------------------------------------------------------------------------
46
// Standard JUnit Class-specific declarations
47

48     private static final Class JavaDoc THIS_CLASS = XmlReportGeneratorUTest.class;
49     private static final AutoDoc DOC = new AutoDoc( THIS_CLASS );
50     
51     public XmlReportGeneratorUTest( String JavaDoc name )
52     {
53         super( name );
54     }
55
56
57     //-------------------------------------------------------------------------
58
// Tests
59

60     
61     public void testConstructor1()
62     {
63         new XmlReportGenerator();
64     }
65     
66     
67     public void testTranslate1()
68     {
69         assertEquals(
70             "Does not translate null.",
71             null,
72             XmlReportGenerator.translate( null ) );
73     }
74     
75     
76     public void testTranslate2()
77     {
78         assertEquals(
79             "Does not translate empty string.",
80             "",
81             XmlReportGenerator.translate( "" ) );
82     }
83     
84     
85     public void testTranslate3()
86     {
87         assertEquals(
88             "Does not translate no parms.",
89             "x",
90             XmlReportGenerator.translate( "x" ) );
91     }
92     
93     
94     public void testTranslate4()
95     {
96         assertEquals(
97             "Does not translate bad parms.",
98             "x(",
99             XmlReportGenerator.translate( "x(" ) );
100     }
101     
102     
103     public void testTranslate5()
104     {
105         assertEquals(
106             "Does not translate only parms.",
107             "(boolean)",
108             XmlReportGenerator.translate( "(Z)" ) );
109     }
110     
111     
112     public void testTranslate6()
113     {
114         assertEquals(
115             "Does not translate empty parms.",
116             "x()",
117             XmlReportGenerator.translate( "x()" ) );
118     }
119     
120     
121     public void testTranslate7()
122     {
123         assertEquals(
124             "Does not translate object.",
125             "x(me.my.Oh)",
126             XmlReportGenerator.translate( "x(Lme/my/Oh;)" ) );
127     }
128     
129     
130     public void testTranslate8()
131     {
132         assertEquals(
133             "Does not translate object.",
134             "x(me.my.Oh, boolean)",
135             XmlReportGenerator.translate( "x(Lme/my/Oh;Z)" ) );
136     }
137     
138     
139     public void testTranslate9()
140     {
141         assertEquals(
142             "Does not strip return.",
143             "x()",
144             XmlReportGenerator.translate( "x()V" ) );
145     }
146     
147     
148     public void testTranslate10()
149     {
150         assertEquals(
151             "Does not strip return.",
152             "x(boolean)",
153             XmlReportGenerator.translate( "x(Z)V" ) );
154     }
155     
156     
157     public void testTranslate11()
158     {
159         assertEquals(
160             "Does not keep <init> as is.",
161             "<init>",
162             XmlReportGenerator.translate( "<init>" ) );
163     }
164     
165     
166     public void testTranslate12()
167     {
168         assertEquals(
169             "Does not keep <init>( as is.",
170             "<init>(",
171             XmlReportGenerator.translate( "<init>(" ) );
172     }
173     
174     
175     public void testTranslate13()
176     {
177         assertEquals(
178             "Does not translate <init>() right.",
179             "[constructor]()",
180             XmlReportGenerator.translate( "<init>()" ) );
181     }
182     
183     
184     public void testTranslate14()
185     {
186         assertEquals(
187             "Does not translate <init>(ZZ) right.",
188             "[constructor](boolean, boolean)",
189             XmlReportGenerator.translate( "<init>(ZZ)" ) );
190     }
191     
192     
193     public void testTranslate15()
194     {
195         assertEquals(
196             "Does not keep <clinit> as is.",
197             "<clinit>",
198             XmlReportGenerator.translate( "<clinit>" ) );
199     }
200     
201     
202     public void testTranslate16()
203     {
204         assertEquals(
205             "Does not keep <clinit>( as is.",
206             "<clinit>(",
207             XmlReportGenerator.translate( "<clinit>(" ) );
208     }
209     
210     
211     public void testTranslate17()
212     {
213         assertEquals(
214             "Does not translate <clinit>() right.",
215             "[static initializer]",
216             XmlReportGenerator.translate( "<clinit>()" ) );
217     }
218     
219     
220     public void testTranslate18()
221     {
222         assertEquals(
223             "Does not translate <clinit>(Z) right.",
224             "[static initializer]",
225             XmlReportGenerator.translate( "<clinit>(Z)" ) );
226     }
227     
228     
229     
230     //-------------------------------------------------------------------------
231
// Helpers
232

233     
234     
235     //-------------------------------------------------------------------------
236
// Standard JUnit declarations
237

238     
239     public static Test suite()
240     {
241         InterfaceTestSuite suite = IReportGeneratorUTestI.suite();
242         suite.addTestSuite( THIS_CLASS );
243         suite.addFactory( new CxFactory( "A" ) {
244             public Object JavaDoc createImplObject() {
245                 return new XmlReportGenerator();
246             }
247         } );
248         
249         return suite;
250     }
251     
252     public static void main( String JavaDoc[] args )
253     {
254         String JavaDoc[] name = { THIS_CLASS.getName() };
255         
256         // junit.textui.TestRunner.main( name );
257
// junit.swingui.TestRunner.main( name );
258

259         junit.textui.TestRunner.main( name );
260     }
261     
262     
263     /**
264      *
265      * @exception Exception thrown under any exceptional condition.
266      */

267     protected void setUp() throws Exception JavaDoc
268     {
269         super.setUp();
270
271        
272         // set ourself up
273
}
274     
275     
276     /**
277      *
278      * @exception Exception thrown under any exceptional condition.
279      */

280     protected void tearDown() throws Exception JavaDoc
281     {
282         // tear ourself down
283

284         
285         super.tearDown();
286     }
287 }
288
289
Popular Tags