KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > mbtf > v1 > assembler > AsmblTransitionSetUTest


1 /*
2  * @(#)AsmblTransitionSetUTest.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.mbtf.v1.assembler;
28
29 import org.easymock.EasyMock;
30 import org.easymock.MockControl;
31 import junit.framework.Test;
32 import junit.framework.TestCase;
33 import junit.framework.TestSuite;
34
35
36 /**
37  * Tests the AsmblTransitionSet class.
38  *
39  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
40  * @version $Date: 2003/02/10 22:52:28 $
41  * @since June 17, 2002
42  */

43 public class AsmblTransitionSetUTest extends TestCase
44 {
45     //-------------------------------------------------------------------------
46
// Standard JUnit Class-specific declarations
47

48     private static final Class JavaDoc THIS_CLASS = AsmblTransitionUTest.class;
49     
50     public AsmblTransitionSetUTest( String JavaDoc name )
51     {
52         super( name );
53     }
54
55     
56     //-------------------------------------------------------------------------
57
// setup
58

59     /**
60      *
61      * @exception Exception thrown under any exceptional condition.
62      */

63     protected void setUp() throws Exception JavaDoc
64     {
65         super.setUp();
66         
67         // set ourself up
68
}
69
70
71     //-------------------------------------------------------------------------
72
// Tests
73

74     
75     public void testConstructor1()
76     {
77         new AsmblTransitionSet();
78     }
79     
80     
81     public void testAddTransition1()
82     {
83         AsmblTransitionSet ats = new AsmblTransitionSet();
84         ats.addTransition( null );
85         AsmblTransition[] v = ats.getTransitions();
86         assertNotNull(
87             "transitions returned null.",
88             v );
89         assertEquals(
90             "transitions size not right.",
91             0,
92             v.length );
93     }
94     
95     
96     public void testAddTransition2()
97     {
98         AsmblTransition at = new AsmblTransition();
99         AsmblTransitionSet ats = new AsmblTransitionSet();
100         ats.addTransition( at );
101         AsmblTransition[] v = ats.getTransitions();
102         assertNotNull(
103             "transitions returned null.",
104             v );
105         assertEquals(
106             "transitions size not right.",
107             1,
108             v.length );
109         assertEquals(
110             "transitions inserted not returned.",
111             at,
112             v[0] );
113     }
114     
115     
116     public void testAddTransitions1()
117     {
118         AsmblTransitionSet ats = new AsmblTransitionSet();
119         ats.addTransitions( null );
120         AsmblTransition[] v = ats.getTransitions();
121         assertNotNull(
122             "transitions returned null.",
123             v );
124         assertEquals(
125             "transitions size not right.",
126             0,
127             v.length );
128     }
129     
130     
131     public void testAddTransitions2()
132     {
133         AsmblTransition[] at = new AsmblTransition[0];
134         AsmblTransitionSet ats = new AsmblTransitionSet();
135         ats.addTransitions( at );
136         AsmblTransition[] v = ats.getTransitions();
137         assertNotNull(
138             "transitions returned null.",
139             v );
140         assertEquals(
141             "transitions size not right.",
142             0,
143             v.length );
144     }
145     
146     
147     public void testAddTransitions3()
148     {
149         AsmblTransition[] at = new AsmblTransition[1];
150         AsmblTransitionSet ats = new AsmblTransitionSet();
151         ats.addTransitions( at );
152         AsmblTransition[] v = ats.getTransitions();
153         assertNotNull(
154             "transitions returned null.",
155             v );
156         assertEquals(
157             "transitions size not right.",
158             0,
159             v.length );
160     }
161     
162     
163     public void testAddTransitions4()
164     {
165         AsmblTransition at = new AsmblTransition();
166         AsmblTransition atlist[] = new AsmblTransition[1];
167         atlist[0] = at;
168         AsmblTransitionSet ats = new AsmblTransitionSet();
169         ats.addTransitions( atlist );
170         AsmblTransition[] v = ats.getTransitions();
171         assertNotNull(
172             "transitions returned null.",
173             v );
174         assertEquals(
175             "transitions size not right.",
176             1,
177             v.length );
178         assertEquals(
179             "transitions inserted not returned.",
180             at,
181             v[0] );
182     }
183     
184     
185     public void testAddTransitions5()
186     {
187         AsmblTransition at = new AsmblTransition();
188         AsmblTransition atlist[] = new AsmblTransition[2];
189         atlist[0] = at;
190         AsmblTransitionSet ats = new AsmblTransitionSet();
191         ats.addTransitions( atlist );
192         AsmblTransition[] v = ats.getTransitions();
193         assertNotNull(
194             "transitions returned null.",
195             v );
196         assertEquals(
197             "transitions size not right.",
198             1,
199             v.length );
200         assertEquals(
201             "transitions inserted not returned.",
202             at,
203             v[0] );
204     }
205     
206     
207     //-------------------------------------------------------------------------
208
// Helpers
209

210     
211     //-------------------------------------------------------------------------
212
// Standard JUnit declarations
213

214     
215     public static Test suite()
216     {
217         TestSuite suite = new TestSuite( THIS_CLASS );
218         
219         // Test the implementation's interface conformity.
220
/*
221         suite.addTest( IxUTestI.suite(
222             new ImplementationCreator[] {
223                 new ImplementationCreator() {
224                     public Object createImplementedObject() {
225                         // XXXXXXXXXXXXXXXXXXXXXXXX
226                     }
227                 },
228             } ) );
229         */

230         return suite;
231     }
232     
233     public static void main( String JavaDoc[] args )
234     {
235         String JavaDoc[] name = { THIS_CLASS.getName() };
236         
237         // junit.textui.TestRunner.main( name );
238
// junit.swingui.TestRunner.main( name );
239

240         junit.textui.TestRunner.main( name );
241     }
242     
243     
244     /**
245      *
246      * @exception Exception thrown under any exceptional condition.
247      */

248     protected void tearDown() throws Exception JavaDoc
249     {
250         // tear ourself down
251

252         super.tearDown();
253     }
254 }
255
256
Popular Tags