KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > firstpartners > nounit > reader > bytecode > test > TestByteCodeProjectSnippetFactory


1 package net.firstpartners.nounit.reader.bytecode.test;
2
3 /**
4  * Title: NoUnit - Identify Classes that are not being unit Tested
5  *
6  * Copyright (C) 2001 Paul Browne , FirstPartners.net
7  *
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * @author Paul Browne
24  * @version 0.7
25  */

26
27
28 import junit.framework.*;
29
30 import net.firstpartners.nounit.reader.*;
31 import net.firstpartners.nounit.reader.bytecode.*;
32 import net.firstpartners.nounit.snippet.*;
33 import net.firstpartners.nounit.test.*;
34
35 import org.apache.log4j.Logger;
36
37 /**
38  * Test the Class Snippet Factory<BR>
39
40  */

41 public class TestByteCodeProjectSnippetFactory extends TestCase {
42
43     //handle to logger
44
static Logger log = Logger.getLogger(TestByteCodeProjectSnippetFactory.class);
45
46   /**
47    * Constructor as required by Junit
48    * @param name to be displayed on testrunner
49    */

50     public TestByteCodeProjectSnippetFactory(String JavaDoc name) {
51     super(name);
52   }
53
54   /**
55    * Code run before each test
56    */

57   public void setUp(){
58
59   }
60
61   /**
62    * Code run after each test
63    */

64   protected void tearDown()
65   {
66
67   }
68
69   /**
70   * Enable Junit to run this Class individually
71   * @param args
72   */

73   public static void main(String JavaDoc[] args) {
74       junit.textui.TestRunner.run (suite());
75   }
76
77   /**
78    * Enable Junit to run this class as part of AllTests.java
79    * @return TestSuite
80    */

81   public static Test suite() {
82       return new TestSuite(TestByteCodeProjectSnippetFactory.class);
83   }
84   
85   public void testGetSnippetInfo() throws Exception JavaDoc {
86       
87       //Local Variables
88
Snippets javaInformation;
89       String JavaDoc info;
90       String JavaDoc sourceDirectory = TestData.SAMPLE_CLASS_SOURCE_FULL;
91       
92            //Get Information about File & assert
93
ISnippetFactory myFactory = new ByteCodeProjectSnippetFactory(sourceDirectory);
94       javaInformation = myFactory.getSnippets();
95       info = javaInformation.toString();
96       
97       
98       log.debug(info);
99       
100       assertTrue(info.indexOf("roject")>-1);
101       assertTrue(info.indexOf("package location")>-1);
102       assertTrue(info.indexOf("public net.firstpartners.nounit")>-1);
103       
104   }
105    
106
107
108 }
Popular Tags