blob: 0a6c6285cd60da04350982f37f09bccd0990bb42 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.scxml2.model;
import org.apache.commons.scxml2.Context;
import org.apache.commons.scxml2.SCXMLExecutor;
import org.apache.commons.scxml2.SCXMLTestHelper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* Unit tests {@link org.apache.commons.scxml2.model.Assign}.
* Unit tests {@link org.apache.commons.scxml2.model.Cancel}.
* Unit tests {@link org.apache.commons.scxml2.model.Else}.
* Unit tests {@link org.apache.commons.scxml2.model.ElseIf}.
* Unit tests {@link org.apache.commons.scxml2.model.If}.
* Unit tests {@link org.apache.commons.scxml2.model.Log}.
* Unit tests {@link org.apache.commons.scxml2.model.Send}.
* Unit tests {@link org.apache.commons.scxml2.model.Var}.
*/
class ActionsTest {
private void runTest(final SCXMLExecutor exec) {
final Context ctx = SCXMLTestHelper.lookupContext(exec, "actionsTest");
Assertions.assertEquals(ctx.get("foo"), "foobar");
Assertions.assertEquals(true, ctx.get("eventsent"), "Missed event transition");
}
@Test
void testInitialActions() throws Exception {
final SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-initial-test.xml");
exec.go();
runTest(exec);
}
@Test
void testParallelActions() throws Exception {
final SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-parallel-test.xml");
exec.go();
runTest(exec);
}
@Test
void testStateActions() throws Exception {
final SCXMLExecutor exec = SCXMLTestHelper.getExecutor("org/apache/commons/scxml2/model/actions-state-test.xml");
exec.go();
runTest(exec);
}
}