testclass Choice for statechart Choice { @Test operation elseChoiceUsingNonDefaultTransition(){ initForEventE(true) assert active (Choice.main_region.C) } @Test operation elseChoiceUsingDefaultTransition(){ initForEventE(false) assert active (Choice.main_region.B) } @Test operation defaultChoiceUsingNonDefaultTransition(){ initForEventG(true) assert active (Choice.main_region.C) } @Test operation defaultChoiceUsingDefaultTransition(){ initForEventG(false) assert active (Choice.main_region.B) } @Test operation uncheckedChoiceUsingNonDefaultTransition(){ initForEventF(true) assert active (Choice.main_region.C) } /* * An outgiong transition with an empty trigger * will be handled like a default transition. */ @Test operation uncheckedChoiceUsingDefaultTransition(){ initForEventF(false) assert active (Choice.main_region.B) } /* A transition with a 'true' guard is always true and must * be used according to its predefined priority. * * This test case makes sure that default transition reordering * does not impact these transitions. */ @Test operation alwaysTrueTransitionInChoice(){ initForEventH(true) assert active (Choice.main_region.C) } operation initForEventE(valueForC : boolean){ enter assert active (Choice.main_region.A) c = valueForC raise e proceed 1 cycle } operation initForEventF(valueForC : boolean){ enter assert active (Choice.main_region.A) c = valueForC raise f proceed 1 cycle } operation initForEventG(valueForC : boolean){ enter assert active (Choice.main_region.A) c = valueForC raise g proceed 1 cycle } operation initForEventH(valueForC : boolean){ enter assert active (Choice.main_region.A) c = valueForC raise h proceed 1 cycle } }