Search in sources :

Example 6 with StateSwitch

use of org.yakindu.sct.model.sexec.StateSwitch in project statecharts by Yakindu.

the class Assert method assertStateSwitch.

public static void assertStateSwitch(Step step, ExecutionState... states) {
    assertNotNull("Step is null", step);
    assertTrue("Step is no StateSwitch (was " + step.getClass().getName() + ")", step instanceof StateSwitch);
    List<ExecutionState> stateList = Arrays.asList(states);
    List<ExecutionState> stateCases = new ArrayList<ExecutionState>();
    for (StateCase aCase : ((StateSwitch) step).getCases()) {
        stateCases.add(aCase.getState());
    }
    assertEquals("StateSwitch cases do not match!", stateList, stateCases);
}
Also used : ExecutionState(org.yakindu.sct.model.sexec.ExecutionState) StateCase(org.yakindu.sct.model.sexec.StateCase) ArrayList(java.util.ArrayList) StateSwitch(org.yakindu.sct.model.sexec.StateSwitch)

Aggregations

StateSwitch (org.yakindu.sct.model.sexec.StateSwitch)6 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)4 Sequence (org.yakindu.sct.model.sexec.Sequence)4 StateCase (org.yakindu.sct.model.sexec.StateCase)4 Test (org.junit.Test)3 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)3 SCTTestUtil.findState (org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState)3 Region (org.yakindu.sct.model.sgraph.Region)3 State (org.yakindu.sct.model.sgraph.State)3 Statechart (org.yakindu.sct.model.sgraph.Statechart)3 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)3 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)3 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)3 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)3 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)3 Reaction (org.yakindu.sct.model.sexec.Reaction)2 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)2 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)2 ArrayList (java.util.ArrayList)1 FeatureCall (org.yakindu.base.expressions.expressions.FeatureCall)1