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: import java.util.Iterator;
028:
029: import junit.framework.Test;
030: import junit.framework.TestCase;
031: import junit.framework.TestSuite;
032: import net.firstpartners.nounit.snippet.ISnippet;
033: import net.firstpartners.nounit.snippet.SnippetClass;
034: import net.firstpartners.nounit.snippet.SnippetMethod;
035: import net.firstpartners.nounit.snippet.Snippets;
036:
037: /**
038: * Test the Class Snippet Factory<BR>
039:
040: */
041: public class TestSnippets extends TestCase {
042:
043: /**
044: * Constructor as required by Junit
045: * @param name to be displayed on testrunner
046: */
047: public TestSnippets(String name) {
048: super (name);
049: }
050:
051: /**
052: * Code run before each test
053: */
054: public void setUp() {
055:
056: }
057:
058: /**
059: * Code run after each test
060: */
061: protected void tearDown() {
062:
063: }
064:
065: /**
066: * Enable Junit to run this Class individually
067: * @param args
068: */
069: public static void main(String[] args) {
070: junit.textui.TestRunner.run(suite());
071: }
072:
073: /**
074: * Enable Junit to run this class as part of AllTests.java
075: * @return TestSuite
076: */
077: public static Test suite() {
078: return new TestSuite(TestSnippets.class);
079: }
080:
081: public void testSnippets() throws Exception {
082:
083: SnippetClass testSClass = new SnippetClass("", "", "",
084: new Snippets());
085: SnippetMethod testSMethod = new SnippetMethod("", "",
086: new HashMap(), null);
087:
088: Snippets mySet = new Snippets();
089: mySet.add(testSClass);
090: mySet.add(testSMethod);
091:
092: //Now Test Iterator
093: Iterator testIterator = mySet.getIterator();
094: while (testIterator.hasNext()) {
095: assertTrue(testIterator.next() instanceof ISnippet);
096: }
097:
098: }
099:
100: }
|