Permalink
Browse files

Update existing test cases for Final keyword

  • Loading branch information...
jblang94 committed Mar 30, 2017
1 parent 4b39bd3 commit 3f0bd5d0bcceb02bdf3f68c30a01bb2a64b54b1a
@@ -961,13 +961,9 @@ public void concurrentFinals()
UmpleClass uClass = model.getUmpleClass("OnOffSwitch");
StateMachine sm = uClass.getStateMachine(0);
State on = sm.findState("On");
State motorFinal = on.getNestedStateMachine(0).findState("Final");
State fanFinal = on.getNestedStateMachine(1).findState("Final");
State finalState = sm.findState("Final");
Assert.assertNotSame(motorFinal, fanFinal);
Assert.assertEquals(true, motorFinal.isFinalState());
Assert.assertEquals(true, fanFinal.isFinalState());
Assert.assertEquals(true, finalState.isFinalState());
}
@Test
@@ -977,12 +973,8 @@ public void finalStateInOneConcurrentRegion()
UmpleClass uClass = model.getUmpleClass("Dryer");
State state = uClass.getStateMachine(0).findState("On").getNestedStateMachine(0).findState("Final");
State state = uClass.getStateMachine(0).findState("Final");
Assert.assertEquals(true, state.isFinalState());
state = uClass.getStateMachine(0).findState("On").getNestedStateMachine(1).findState("Final");
Assert.assertEquals(null, state);
}
@Test
@@ -992,13 +984,8 @@ public void finalStateInTwoConcurrentRegions()
UmpleClass uClass = model.getUmpleClass("Dryer");
State final1 = uClass.getStateMachine(0).findState("On").getNestedStateMachine(0).findState("Final");
State final1 = uClass.getStateMachine(0).findState("Final");
Assert.assertEquals(true, final1.isFinalState());
State final2 = uClass.getStateMachine(0).findState("On").getNestedStateMachine(1).findState("Final");
Assert.assertEquals(true, final2.isFinalState());
Assert.assertNotSame(final1, final2);
}
@Test
@@ -1007,7 +994,7 @@ public void finalStateNoAction()
assertParse("211_finalState_noAction.ump", "[classDefinition][name:DVDplayer][stateMachine][inlineStateMachine][name:DVDplayerStatus][state][stateName:NormalOperation][state][stateName:On][state][stateName:Playing][transition][event:stop][stateName:Stopped][state][stateName:Stopped][transition][event:play][stateName:Playing][transition][event:pause][stateName:Paused][state][stateName:history][state][stateName:Off][transition][event:turnOn][stateName:Final]");
UmpleClass uClass = model.getUmpleClass("DVDplayer");
State final1 = uClass.getStateMachine(0).findState("NormalOperation").getNestedStateMachine(0).findState("Final");
State final1 = uClass.getStateMachine(0).findState("Final");
Assert.assertEquals(true, final1.isFinalState());
}
@@ -1017,7 +1004,7 @@ public void finalStateWithAction()
assertParse("211_finalState_withAction.ump", "[classDefinition][name:DVDplayer][stateMachine][inlineStateMachine][name:DVDplayerStatus][state][stateName:NormalOperation][state][stateName:On][state][stateName:Playing][transition][event:stop][stateName:Stopped][state][stateName:Stopped][transition][event:play][stateName:Playing][transition][event:pause][stateName:Paused][state][stateName:history][state][stateName:Off][transition][event:turnOn][action][code:actionCode][stateName:Final]");
UmpleClass uClass = model.getUmpleClass("DVDplayer");
State final1 = uClass.getStateMachine(0).findState("NormalOperation").getNestedStateMachine(0).findState("Final");
State final1 = uClass.getStateMachine(0).findState("Final");
Assert.assertEquals(true, final1.isFinalState());
}
@@ -15,7 +15,7 @@ public void CallDeleteOnceInFinalState()
}
@Test
public void CallDeleteAsSoonAsOneFinalStateIsReached()
public void CallDeleteWhenTransitionUsesFinalKeyword()
{
CourseL c = new CourseL();
Assert.assertEquals(CourseL.Status.On,c.getStatus());
@@ -27,9 +27,9 @@ public void CallDeleteAsSoonAsOneFinalStateIsReached()
Assert.assertEquals(1,c.numberOfLogs());
Assert.assertEquals("deleted",c.getLog(0));
Assert.assertEquals(CourseL.Status.On,c.getStatus());
Assert.assertEquals(CourseL.StatusOnMotorIdle.Final,c.getStatusOnMotorIdle());
Assert.assertEquals(CourseL.StatusOnFanIdle.FanIdle,c.getStatusOnFanIdle());
Assert.assertEquals(CourseL.Status.Final,c.getStatus());
Assert.assertEquals(CourseL.StatusOnMotorIdle.Null,c.getStatusOnMotorIdle());
Assert.assertEquals(CourseL.StatusOnFanIdle.Null,c.getStatusOnFanIdle());
}

0 comments on commit 3f0bd5d

Please sign in to comment.