1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.scxml2.model;
18
19 import org.apache.commons.scxml2.Context;
20 import org.apache.commons.scxml2.SCXMLExecutor;
21 import org.apache.commons.scxml2.SCXMLTestHelper;
22 import org.junit.Assert;
23 import org.junit.Test;
24
25
26
27
28
29
30
31
32
33
34 public class ActionsTest {
35
36 @Test
37 public void testStateActions() throws Exception {
38 SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-state-test.xml");
39 exec.go();
40 runTest(exec);
41 }
42
43 @Test
44 public void testParallelActions() throws Exception {
45 SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-parallel-test.xml");
46 exec.go();
47 runTest(exec);
48 }
49
50 @Test
51 public void testInitialActions() throws Exception {
52 SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-initial-test.xml");
53 exec.go();
54 runTest(exec);
55 }
56
57 private void runTest(SCXMLExecutor exec) throws Exception {
58 Context ctx = SCXMLTestHelper.lookupContext(exec, "actionsTest");
59 Assert.assertEquals(ctx.get("foo"), "foobar");
60 Assert.assertEquals("Missed event transition",
61 true, ctx.get("eventsent"));
62 }
63 }
64