1 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 43 public class AsmblTransitionSetUTest extends TestCase 44 { 45 48 private static final Class THIS_CLASS = AsmblTransitionUTest.class; 49 50 public AsmblTransitionSetUTest( String name ) 51 { 52 super( name ); 53 } 54 55 56 59 63 protected void setUp() throws Exception 64 { 65 super.setUp(); 66 67 } 69 70 71 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 210 211 214 215 public static Test suite() 216 { 217 TestSuite suite = new TestSuite( THIS_CLASS ); 218 219 230 return suite; 231 } 232 233 public static void main( String [] args ) 234 { 235 String [] name = { THIS_CLASS.getName() }; 236 237 240 junit.textui.TestRunner.main( name ); 241 } 242 243 244 248 protected void tearDown() throws Exception 249 { 250 252 super.tearDown(); 253 } 254 } 255 256 | Popular Tags |