001: /*
002: * @(#)AsmblTransitionSetUTest.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.mbtf.v1.assembler;
028:
029: import org.easymock.EasyMock;
030: import org.easymock.MockControl;
031: import junit.framework.Test;
032: import junit.framework.TestCase;
033: import junit.framework.TestSuite;
034:
035: /**
036: * Tests the AsmblTransitionSet class.
037: *
038: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
039: * @version $Date: 2003/02/10 22:52:28 $
040: * @since June 17, 2002
041: */
042: public class AsmblTransitionSetUTest extends TestCase {
043: //-------------------------------------------------------------------------
044: // Standard JUnit Class-specific declarations
045:
046: private static final Class THIS_CLASS = AsmblTransitionUTest.class;
047:
048: public AsmblTransitionSetUTest(String name) {
049: super (name);
050: }
051:
052: //-------------------------------------------------------------------------
053: // setup
054:
055: /**
056: *
057: * @exception Exception thrown under any exceptional condition.
058: */
059: protected void setUp() throws Exception {
060: super .setUp();
061:
062: // set ourself up
063: }
064:
065: //-------------------------------------------------------------------------
066: // Tests
067:
068: public void testConstructor1() {
069: new AsmblTransitionSet();
070: }
071:
072: public void testAddTransition1() {
073: AsmblTransitionSet ats = new AsmblTransitionSet();
074: ats.addTransition(null);
075: AsmblTransition[] v = ats.getTransitions();
076: assertNotNull("transitions returned null.", v);
077: assertEquals("transitions size not right.", 0, v.length);
078: }
079:
080: public void testAddTransition2() {
081: AsmblTransition at = new AsmblTransition();
082: AsmblTransitionSet ats = new AsmblTransitionSet();
083: ats.addTransition(at);
084: AsmblTransition[] v = ats.getTransitions();
085: assertNotNull("transitions returned null.", v);
086: assertEquals("transitions size not right.", 1, v.length);
087: assertEquals("transitions inserted not returned.", at, v[0]);
088: }
089:
090: public void testAddTransitions1() {
091: AsmblTransitionSet ats = new AsmblTransitionSet();
092: ats.addTransitions(null);
093: AsmblTransition[] v = ats.getTransitions();
094: assertNotNull("transitions returned null.", v);
095: assertEquals("transitions size not right.", 0, v.length);
096: }
097:
098: public void testAddTransitions2() {
099: AsmblTransition[] at = new AsmblTransition[0];
100: AsmblTransitionSet ats = new AsmblTransitionSet();
101: ats.addTransitions(at);
102: AsmblTransition[] v = ats.getTransitions();
103: assertNotNull("transitions returned null.", v);
104: assertEquals("transitions size not right.", 0, v.length);
105: }
106:
107: public void testAddTransitions3() {
108: AsmblTransition[] at = new AsmblTransition[1];
109: AsmblTransitionSet ats = new AsmblTransitionSet();
110: ats.addTransitions(at);
111: AsmblTransition[] v = ats.getTransitions();
112: assertNotNull("transitions returned null.", v);
113: assertEquals("transitions size not right.", 0, v.length);
114: }
115:
116: public void testAddTransitions4() {
117: AsmblTransition at = new AsmblTransition();
118: AsmblTransition atlist[] = new AsmblTransition[1];
119: atlist[0] = at;
120: AsmblTransitionSet ats = new AsmblTransitionSet();
121: ats.addTransitions(atlist);
122: AsmblTransition[] v = ats.getTransitions();
123: assertNotNull("transitions returned null.", v);
124: assertEquals("transitions size not right.", 1, v.length);
125: assertEquals("transitions inserted not returned.", at, v[0]);
126: }
127:
128: public void testAddTransitions5() {
129: AsmblTransition at = new AsmblTransition();
130: AsmblTransition atlist[] = new AsmblTransition[2];
131: atlist[0] = at;
132: AsmblTransitionSet ats = new AsmblTransitionSet();
133: ats.addTransitions(atlist);
134: AsmblTransition[] v = ats.getTransitions();
135: assertNotNull("transitions returned null.", v);
136: assertEquals("transitions size not right.", 1, v.length);
137: assertEquals("transitions inserted not returned.", at, v[0]);
138: }
139:
140: //-------------------------------------------------------------------------
141: // Helpers
142:
143: //-------------------------------------------------------------------------
144: // Standard JUnit declarations
145:
146: public static Test suite() {
147: TestSuite suite = new TestSuite(THIS_CLASS);
148:
149: // Test the implementation's interface conformity.
150: /*
151: suite.addTest( IxUTestI.suite(
152: new ImplementationCreator[] {
153: new ImplementationCreator() {
154: public Object createImplementedObject() {
155: // XXXXXXXXXXXXXXXXXXXXXXXX
156: }
157: },
158: } ) );
159: */
160: return suite;
161: }
162:
163: public static void main(String[] args) {
164: String[] name = { THIS_CLASS.getName() };
165:
166: // junit.textui.TestRunner.main( name );
167: // junit.swingui.TestRunner.main( name );
168:
169: junit.textui.TestRunner.main(name);
170: }
171:
172: /**
173: *
174: * @exception Exception thrown under any exceptional condition.
175: */
176: protected void tearDown() throws Exception {
177: // tear ourself down
178:
179: super.tearDown();
180: }
181: }
|