001: package net.firstpartners.nounit.snippet.test;
002:
003: /**
004: * Title: NoUnit - Identify Classes that are not being unit Tested
005: *
006: * Copyright (C) 2001 Paul Browne , FirstPartners.net
007: *
008: *
009: * This program is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; either version 2
012: * of the License, or (at your option) any later version.
013: *
014: * This program is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017: * GNU General Public License for more details.
018: *
019: * You should have received a copy of the GNU General Public License
020: * along with this program; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * @author Paul Browne
024: * @version 0.7
025: */
026: import java.util.HashMap;
027:
028: import net.firstpartners.nounit.snippet.ISnippet;
029: import net.firstpartners.nounit.snippet.SnippetCalls;
030: import net.firstpartners.nounit.snippet.SnippetClass;
031: import net.firstpartners.nounit.snippet.SnippetMethod;
032: import net.firstpartners.nounit.snippet.SnippetPackage;
033: import net.firstpartners.nounit.snippet.Snippets;
034:
035: /**
036: * Provides standard information for testing Snippets
037: */
038: public class TestSnippetData {
039:
040: /**
041: * Mock up some SnippetClasses for testing
042: */
043: public static Snippets getSnippetPackages() {
044:
045: Snippets someClasses = getSnippetClasses();
046:
047: ISnippet testProject1 = new SnippetPackage("location1",
048: someClasses);
049: ISnippet testProject2 = new SnippetPackage("location1",
050: someClasses);
051: ISnippet testProject3 = new SnippetPackage("location1",
052: someClasses);
053:
054: Snippets somePackages = new Snippets();
055: somePackages.add(testProject1);
056: somePackages.add(testProject2);
057: somePackages.add(testProject3);
058:
059: return somePackages;
060:
061: }
062:
063: /**
064: * Mock up some SnippetClasses for testing
065: */
066: public static Snippets getSnippetClasses() {
067:
068: Snippets someMethods = getSnippetMethods();
069:
070: ISnippet testClass = new SnippetClass("TestName", "protected",
071: "java.lang.Object", someMethods);
072:
073: Snippets someClasses = new Snippets();
074: someClasses.add(testClass);
075:
076: return someClasses;
077:
078: }
079:
080: /**
081: * Mock up some SnippetMethods for testing
082: */
083: public static Snippets getSnippetMethods() {
084:
085: //Local Variables
086: Snippets someMethods = new Snippets();
087: HashMap methodParams = new HashMap();
088:
089: //Mockup methodParams
090: methodParams.put("0", "java.lang.String");
091: methodParams.put("1", "java.lang.Integer");
092: methodParams.put("2", "java.lang.Double");
093:
094: //Mock up some methods
095: ISnippet testClass1 = new SnippetMethod("method1", "public",
096: methodParams, null);
097: ISnippet testClass2 = new SnippetMethod("method2", "protected",
098: methodParams, null);
099: ISnippet testClass3 = new SnippetMethod("method3", "private",
100: methodParams, null);
101:
102: //Add to colleciton and return
103: Snippets someClasses = new Snippets();
104: someMethods.add(testClass1);
105: someMethods.add(testClass2);
106: someMethods.add(testClass3);
107:
108: return someMethods;
109:
110: }
111:
112: /**
113: * Mock up some SnippetMethods for testing
114: */
115: public static Snippets getSnippetCalledMethods() {
116:
117: //Local Variables
118: Snippets someCalledMethods = new Snippets();
119: HashMap methodParams = new HashMap();
120:
121: //Mockup methodParams
122: methodParams.put("0", "java.lang.String");
123: methodParams.put("1", "java.lang.Integer");
124: methodParams.put("2", "java.lang.Double");
125:
126: //Mock up some methods
127: ISnippet testClass1 = new SnippetCalls("Class1",
128: "called-method1", methodParams);
129: ISnippet testClass2 = new SnippetCalls("Class2",
130: "called-method2", methodParams);
131: ISnippet testClass3 = new SnippetCalls("Class3",
132: "called-method3", methodParams);
133:
134: //Add to colleciton and return
135: Snippets someClasses = new Snippets();
136: someCalledMethods.add(testClass1);
137: someCalledMethods.add(testClass2);
138: someCalledMethods.add(testClass3);
139:
140: return someCalledMethods;
141:
142: }
143:
144: }
|