1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.scxml.model;
17
18 import junit.framework.Test;
19 import junit.framework.TestCase;
20 import junit.framework.TestSuite;
21
22 public class TransitionTest extends TestCase {
23
24 public TransitionTest(String testName) {
25 super(testName);
26 }
27
28 public static Test suite() {
29 return new TestSuite(TransitionTest.class);
30 }
31
32 public static void main(String args[]) {
33 String[] testCaseName = { TransitionTest.class.getName()};
34 junit.textui.TestRunner.main(testCaseName);
35 }
36
37 private Transition transition;
38
39 public void setUp() {
40 transition = new Transition();
41 }
42
43 public void testGetRuntimeTargetNullNoParent() {
44 transition.setTarget(null);
45
46 assertNull(transition.getRuntimeTarget());
47 }
48
49 public void testGetRuntimeTargetNullWithParent() {
50 State state = new State();
51 state.setId("1");
52
53 transition.setTarget(null);
54 transition.setParent(state);
55
56 assertEquals("1", transition.getRuntimeTarget().getId());
57 }
58
59 public void testGetRuntimeTarget() {
60 State state = new State();
61 state.setId("2");
62
63 transition.setTarget(state);
64
65 assertEquals("2", transition.getRuntimeTarget().getId());
66 }
67
68 public void testGetPath() {
69 assertNotNull(transition.getPath());
70 }
71 }