KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)AsmblStateSetUTest.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 AsmblStateSet 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:27 $
41  * @since June 17, 2002
42  */

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

48     private static final Class JavaDoc THIS_CLASS = AsmblStateUTest.class;
49     
50     public AsmblStateSetUTest( 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 AsmblStateSet();
78     }
79     
80     
81     public void testAddState1()
82     {
83         AsmblStateSet ats = new AsmblStateSet();
84         ats.addState( null );
85         AsmblState[] v = ats.getStates();
86         assertNotNull(
87             "states returned null.",
88             v );
89         assertEquals(
90             "states size not right.",
91             0,
92             v.length );
93     }
94     
95     
96     public void testAddState2()
97     {
98         AsmblState at = new AsmblState();
99         AsmblStateSet ats = new AsmblStateSet();
100         ats.addState( at );
101         AsmblState[] v = ats.getStates();
102         assertNotNull(
103             "states returned null.",
104             v );
105         assertEquals(
106             "states size not right.",
107             1,
108             v.length );
109         assertEquals(
110             "states inserted not returned.",
111             at,
112             v[0] );
113     }
114     
115     
116     public void testAddStates1()
117     {
118         AsmblStateSet ats = new AsmblStateSet();
119         ats.addStates( null );
120         AsmblState[] v = ats.getStates();
121         assertNotNull(
122             "states returned null.",
123             v );
124         assertEquals(
125             "states size not right.",
126             0,
127             v.length );
128     }
129     
130     
131     public void testAddStates2()
132     {
133         AsmblState[] at = new AsmblState[0];
134         AsmblStateSet ats = new AsmblStateSet();
135         ats.addStates( at );
136         AsmblState[] v = ats.getStates();
137         assertNotNull(
138             "states returned null.",
139             v );
140         assertEquals(
141             "states size not right.",
142             0,
143             v.length );
144     }
145     
146     
147     public void testAddStates3()
148     {
149         AsmblState[] at = new AsmblState[1];
150         AsmblStateSet ats = new AsmblStateSet();
151         ats.addStates( at );
152         AsmblState[] v = ats.getStates();
153         assertNotNull(
154             "states returned null.",
155             v );
156         assertEquals(
157             "states size not right.",
158             0,
159             v.length );
160     }
161     
162     
163     public void testAddStates4()
164     {
165         AsmblState at = new AsmblState();
166         AsmblState atlist[] = new AsmblState[1];
167         atlist[0] = at;
168         AsmblStateSet ats = new AsmblStateSet();
169         ats.addStates( atlist );
170         AsmblState[] v = ats.getStates();
171         assertNotNull(
172             "states returned null.",
173             v );
174         assertEquals(
175             "states size not right.",
176             1,
177             v.length );
178         assertEquals(
179             "states inserted not returned.",
180             at,
181             v[0] );
182     }
183     
184     
185     public void testAddStates5()
186     {
187         AsmblState at = new AsmblState();
188         AsmblState atlist[] = new AsmblState[2];
189         atlist[0] = at;
190         AsmblStateSet ats = new AsmblStateSet();
191         ats.addStates( atlist );
192         AsmblState[] v = ats.getStates();
193         assertNotNull(
194             "states returned null.",
195             v );
196         assertEquals(
197             "states size not right.",
198             1,
199             v.length );
200         assertEquals(
201             "states 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