|
|
@@ -29,7 +29,6 @@ import static org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator.ISSUE_
|
|
|
import static org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator.ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_ORTHOGONAL;
|
|
|
import static org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator.ISSUE_SYNCHRONIZATION_TARGET_STATES_NOT_WITHIN_SAME_PARENTSTATE;
|
|
|
import static org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator.ISSUE_SYNCHRONIZATION_TRANSITION_COUNT;
|
|
|
-import static org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator.ISSUE_TRANSITION_WITHOUT_GUARD;
|
|
|
import static org.yakindu.sct.test.models.AbstractTestModelsUtil.VALIDATION_TESTMODEL_DIR;
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
@@ -48,6 +47,7 @@ import org.junit.runner.RunWith;
|
|
|
import org.yakindu.sct.model.sgraph.Choice;
|
|
|
import org.yakindu.sct.model.sgraph.Entry;
|
|
|
import org.yakindu.sct.model.sgraph.EntryKind;
|
|
|
+import org.yakindu.sct.model.sgraph.Exit;
|
|
|
import org.yakindu.sct.model.sgraph.FinalState;
|
|
|
import org.yakindu.sct.model.sgraph.Region;
|
|
|
import org.yakindu.sct.model.sgraph.SGraphFactory;
|
|
|
@@ -510,28 +510,68 @@ public class SGraphJavaValidationTest {
|
|
|
*/
|
|
|
@Test
|
|
|
public void transitionsWithNoGuard(){
|
|
|
- statechart = factory.createStatechart();
|
|
|
- Region region = factory.createRegion();
|
|
|
- Entry e = factory.createEntry();
|
|
|
+ statechart = factory.createStatechart();
|
|
|
+ region = factory.createRegion();
|
|
|
+
|
|
|
+ //create vertices for main region
|
|
|
+ Entry entry = factory.createEntry();
|
|
|
State a = factory.createState();
|
|
|
- State b = factory.createState();
|
|
|
a.setName("A");
|
|
|
+ State b = factory.createState();
|
|
|
b.setName("B");
|
|
|
- Transition eToA = createTransition(e, a);
|
|
|
+ State c = factory.createState();
|
|
|
+ c.setName("C");
|
|
|
+ State d = factory.createState();
|
|
|
+ c.setName("D");
|
|
|
+ Transition entryToA = createTransition(entry, a);
|
|
|
Transition aToB = createTransition(a, b);
|
|
|
- statechart.getRegions().add(region);
|
|
|
- region.getVertices().add(e);
|
|
|
+ Transition bToC = createTransition(b, c);
|
|
|
+ Transition cToD = createTransition(c, d);
|
|
|
+
|
|
|
+ //create vertices for compositState
|
|
|
+ State bb = factory.createState();
|
|
|
+ bb.setName("BB");
|
|
|
+ Entry entryB = factory.createEntry();
|
|
|
+ Exit exitB = factory.createExit();
|
|
|
+
|
|
|
+ Region b_region = factory.createRegion();
|
|
|
+ b_region.getVertices().add(entryB);
|
|
|
+ b_region.getVertices().add(bb);
|
|
|
+ b_region.getVertices().add(exitB);
|
|
|
+ b.getRegions().add(b_region);
|
|
|
+ Transition entryBToBB = createTransition(entryB, bb);
|
|
|
+ Transition bbToExitB = createTransition(bb, exitB);
|
|
|
+
|
|
|
+ region.getVertices().add(entry);
|
|
|
region.getVertices().add(a);
|
|
|
region.getVertices().add(b);
|
|
|
+ region.getVertices().add(c);
|
|
|
+ region.getVertices().add(d);
|
|
|
+ statechart.getRegions().add(region);
|
|
|
|
|
|
- // transitions from entry point -> valid model with no warnings
|
|
|
- assertTrue(validator.validate(eToA, diagnostics, new HashMap<Object, Object>()));
|
|
|
+ // transitions from entry point to State A -> valid model with no warnings
|
|
|
+ assertTrue(validator.validate(entryToA, diagnostics, new HashMap<Object, Object>()));
|
|
|
assertIssueCount(diagnostics, 0);
|
|
|
-
|
|
|
- //other transitions with no trigger -> valid model with warning
|
|
|
+
|
|
|
+ //transition from StateA to StateB -> valid model with warnings expect 1 warning in total
|
|
|
assertTrue(validator.validate(aToB, diagnostics, new HashMap<Object, Object>()));
|
|
|
assertIssueCount(diagnostics, 1);
|
|
|
- assertWarning(diagnostics, ISSUE_TRANSITION_WITHOUT_GUARD);
|
|
|
+
|
|
|
+ //transition from EntryB to StateBB -> valid model with no warnings expect 1 warning in total
|
|
|
+ assertTrue(validator.validate(entryBToBB, diagnostics, new HashMap<Object, Object>()));
|
|
|
+ assertIssueCount(diagnostics, 1);
|
|
|
+
|
|
|
+ //transition from BB to ExitB -> valid model with warnings expect 2 warning in total
|
|
|
+ assertTrue(validator.validate(bbToExitB, diagnostics, new HashMap<Object, Object>()));
|
|
|
+ assertIssueCount(diagnostics, 2);
|
|
|
+
|
|
|
+ //transition from B to C -> valid model with no warning warnings expect 2 warning in total
|
|
|
+ assertTrue(validator.validate(bToC, diagnostics, new HashMap<Object, Object>()));
|
|
|
+ assertIssueCount(diagnostics, 2);
|
|
|
+
|
|
|
+ //transition from C to D -> valid model with warning warning expect 3 warning in total
|
|
|
+ assertTrue(validator.validate(cToD, diagnostics, new HashMap<Object, Object>()));
|
|
|
+ assertIssueCount(diagnostics, 3);
|
|
|
}
|
|
|
|
|
|
@Test
|