001: /*
002: * @(#)AbstractTestIssueRecordCollatorUTestI.java
003: *
004: * Copyright (C) 2002-2003 Matt Albrecht
005: * groboclown@users.sourceforge.net
006: * http://groboutils.sourceforge.net
007: *
008: * Permission is hereby granted, free of charge, to any person obtaining a
009: * copy of this software and associated documentation files (the "Software"),
010: * to deal in the Software without restriction, including without limitation
011: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
012: * and/or sell copies of the Software, and to permit persons to whom the
013: * Software is furnished to do so, subject to the following conditions:
014: *
015: * The above copyright notice and this permission notice shall be included in
016: * all copies or substantial portions of the Software.
017: *
018: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
019: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
020: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
021: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
022: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
023: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
024: * DEALINGS IN THE SOFTWARE.
025: */
026:
027: package net.sourceforge.groboutils.pmti.v1.itf.impl;
028:
029: import net.sourceforge.groboutils.pmti.v1.itf.*;
030:
031: import net.sourceforge.groboutils.autodoc.v1.AutoDoc;
032: import org.easymock.EasyMock;
033: import org.easymock.MockControl;
034: import net.sourceforge.groboutils.junit.v1.iftc.*;
035: import junit.framework.Test;
036: import junit.framework.TestCase;
037: import junit.framework.TestSuite;
038:
039: /**
040: * Tests the AbstractTestIssueRecordCollator interface.
041: *
042: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
043: * @since July 14, 2002
044: * @version $Date: 2003/02/10 22:52:06 $
045: */
046: public class AbstractTestIssueRecordCollatorUTestI extends
047: InterfaceTestCase {
048: //-------------------------------------------------------------------------
049: // Standard JUnit Class-specific declarations
050:
051: private static final Class THIS_CLASS = AbstractTestIssueRecordCollatorUTestI.class;
052: private static final AutoDoc DOC = new AutoDoc(THIS_CLASS);
053:
054: public AbstractTestIssueRecordCollatorUTestI(String name,
055: ImplFactory f) {
056: super (name, AbstractTestIssueRecordCollator.class, f);
057: }
058:
059: public AbstractTestIssueRecordCollator createAbstractTestIssueRecordCollator() {
060: return (AbstractTestIssueRecordCollator) createImplObject();
061: }
062:
063: //-------------------------------------------------------------------------
064: // Tests
065:
066: public void testGetFactor0() {
067: AbstractTestIssueRecordCollator atirc = createAbstractTestIssueRecordCollator();
068: try {
069: atirc.getFactor(null);
070: fail("Did not throw an exception.");
071: } catch (RuntimeException e) {
072: DOC.getLog().debug("Threw exception", e);
073: }
074: }
075:
076: public void testGetFactor1() {
077: AbstractTestIssueRecordCollator atirc = createAbstractTestIssueRecordCollator();
078: Object r = atirc.getFactor(createRecord1());
079: assertNotNull("factor is null.", r);
080: }
081:
082: public void testGetFactor2() {
083: AbstractTestIssueRecordCollator atirc = createAbstractTestIssueRecordCollator();
084: Object r = atirc.getFactor(createRecord2());
085: assertNotNull("factor is null.", r);
086: }
087:
088: public void testGetFactor3() {
089: AbstractTestIssueRecordCollator atirc = createAbstractTestIssueRecordCollator();
090: Object r = atirc.getFactor(createRecord3());
091: assertNotNull("factor is null.", r);
092: }
093:
094: //-------------------------------------------------------------------------
095: // Helpers
096:
097: protected ITestIssueRecord createRecord1() {
098: IIssueRecord ir = new DefaultIssueRecord("", null);
099: DefaultTestRecord tr = new DefaultTestRecord();
100: ITestIssueRecord tir = new DefaultTestIssueRecord(ir, tr,
101: "text 1");
102: return tir;
103: }
104:
105: protected ITestIssueRecord createRecord2() {
106: IIssueRecord ir = new DefaultIssueRecord("", null);
107: DefaultTestRecord tr = new DefaultTestRecord();
108: tr.setTestSuite("suite");
109:
110: ITestIssueRecord tir = new DefaultTestIssueRecord(ir, tr,
111: "text 2");
112: return tir;
113: }
114:
115: protected ITestIssueRecord createRecord3() {
116: IIssueRecord ir = new DefaultIssueRecord("", null);
117: DefaultTestRecord tr = new DefaultTestRecord();
118: tr.setTestSuite("suite");
119: tr.setTestName("name");
120:
121: ITestIssueRecord tir = new DefaultTestIssueRecord(ir, tr,
122: "text 3");
123: return tir;
124: }
125:
126: //-------------------------------------------------------------------------
127: // Standard JUnit declarations
128:
129: public static InterfaceTestSuite suite() {
130: InterfaceTestSuite suite = new InterfaceTestSuite(THIS_CLASS);
131:
132: suite.addInterfaceTestSuite(ITestIssueRecordCollatorUTestI
133: .suite());
134:
135: return suite;
136: }
137:
138: public static void main(String[] args) {
139: String[] name = { THIS_CLASS.getName() };
140:
141: // junit.textui.TestRunner.main( name );
142: // junit.swingui.TestRunner.main( name );
143:
144: junit.textui.TestRunner.main(name);
145: }
146:
147: /**
148: *
149: * @exception Exception thrown under any exceptional condition.
150: */
151: protected void setUp() throws Exception {
152: super .setUp();
153:
154: // set ourself up
155: }
156:
157: /**
158: *
159: * @exception Exception thrown under any exceptional condition.
160: */
161: protected void tearDown() throws Exception {
162: // tear ourself down
163:
164: super.tearDown();
165: }
166: }
|