浏览代码

Generated tests for statemachine keywords.

Markus Mühlbrandt 9 年之前
父节点
当前提交
f7db8091cf

+ 9 - 1
test-plugins/org.yakindu.sct.generator.java.test/model/test.sgen

@@ -485,5 +485,13 @@ GeneratorModel for sctunit::java {
 			targetProject = "org.yakindu.sct.generator.java.test" 
 			targetFolder = "test-gen"			
 		}			
-	}		
+	}
+	
+	test StatemachineKeywords {
+
+		feature Outlet {
+			targetProject = "org.yakindu.sct.generator.java.test"
+			targetFolder = "test-gen"
+		}
+	}
 }

+ 10 - 9
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/AllTestsTest.java

@@ -16,15 +16,16 @@ import org.junit.runners.Suite.SuiteClasses;
 @RunWith(Suite.class)
 @SuiteClasses({AlwaysOncycleTest.class, AssignmentAsExpressionTest.class, BitExpressionsTest.class,
 		BooleanExpressionsTest.class, CastExpressionsTest.class, ChoiceTest.class, CKeywordsTest.class,
-		ConditionalExpressionTest.class, ConstantsTestsTest.class, DeclarationsTest.class, DeepEntryTest.class,
-		DeepHistoryTest.class, DynamicChoiceTest.class, EmptyTransitionTest.class, EnterStateTest.class,
-		EntryChoiceTest.class, EntryExitSelfTransitionTest.class, EntryReactionActionTest.class,
-		ExitOnSelfTransitionTest.class, ExitStateTest.class, FeatureCallsTest.class, FinalStateTest.class,
-		GuardTest.class, GuardedEntryTest.class, GuardedExitTest.class, HistoryWithExitPointTest.class,
-		HistoryWithoutInitialStepTest.class, InEventLifeCycleTest.class, IntegerExpressionsTest.class,
-		InternalEventLifeCycleTest.class, LocalReactionsTest.class, LogicalAndTestsTest.class, LogicalOrTestsTest.class,
-		NamedInterfaceAccessTest.class, OutEventLifeCycleTest.class, ParenthesisTest.class, PriorityValuesTest.class,
-		RaiseEventTest.class, ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
+		StatemachineKeywordsTest.class, ConditionalExpressionTest.class, ConstantsTestsTest.class,
+		DeclarationsTest.class, DeepEntryTest.class, DeepHistoryTest.class, DynamicChoiceTest.class,
+		EmptyTransitionTest.class, EnterStateTest.class, EntryChoiceTest.class, EntryExitSelfTransitionTest.class,
+		EntryReactionActionTest.class, ExitOnSelfTransitionTest.class, ExitStateTest.class, FeatureCallsTest.class,
+		FinalStateTest.class, GuardTest.class, GuardedEntryTest.class, GuardedExitTest.class,
+		HistoryWithExitPointTest.class, HistoryWithoutInitialStepTest.class, InEventLifeCycleTest.class,
+		IntegerExpressionsTest.class, InternalEventLifeCycleTest.class, LocalReactionsTest.class,
+		LogicalAndTestsTest.class, LogicalOrTestsTest.class, NamedInterfaceAccessTest.class,
+		OutEventLifeCycleTest.class, ParenthesisTest.class, PriorityValuesTest.class, RaiseEventTest.class,
+		ReadOnlyVariableTest.class, SameNameDifferentRegionTest.class, ShallowHistoryTest.class,
 		ShallowHistoryWithDeepEntryTest.class, SimpleEventTest.class, SimpleHierachyTest.class,
 		StatechartActiveTest.class, StatechartLocalReactionsTest.class, StateIsActiveTest.class, StaticChoiceTest.class,
 		STextKeywordsInStatesAndRegionsTest.class, StringExpressionsTest.class, SyncForkTest.class, SyncJoinTest.class,

+ 46 - 0
test-plugins/org.yakindu.sct.generator.java.test/test-gen/org/yakindu/sct/generator/java/test/StatemachineKeywordsTest.java

@@ -0,0 +1,46 @@
+/**
+* Copyright (c) 2016 committers of YAKINDU and others.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+*     committers of YAKINDU - initial API and implementation
+*/
+
+package org.yakindu.sct.generator.java.test;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.yakindu.scr.statechartkeywords.StatechartKeywordsStatemachine;
+import org.yakindu.scr.statechartkeywords.StatechartKeywordsStatemachine.State;
+import org.yakindu.scr.TimerService;
+/**
+ *  Unit TestCase for StatechartKeywords
+ */
+@SuppressWarnings("all")
+public class StatemachineKeywordsTest {
+
+	private StatechartKeywordsStatemachine statemachine;
+
+	@Before
+	public void setUp() {
+		statemachine = new StatechartKeywordsStatemachine();
+		statemachine.setTimer(new TimerService());
+		statemachine.init();
+	}
+
+	@After
+	public void tearDown() {
+		statemachine = null;
+	}
+
+	@Test
+	public void teststatemachineKeywords() {
+		statemachine.enter();
+		assertTrue(statemachine.isStateActive(State.main_region_Timer));
+	}
+}