nz.ac.waikato.modeljunit.examples
Class SpecialFSMNoLoops

java.lang.Object
  extended by nz.ac.waikato.modeljunit.examples.SpecialFSMNoLoops
All Implemented Interfaces:
FsmModel

public class SpecialFSMNoLoops
extends java.lang.Object
implements FsmModel

Simple FSM that is specialized so All Round Trips runs better


Constructor Summary
SpecialFSMNoLoops()
           
 
Method Summary
 void action0()
           
 boolean action0Guard()
           
 void action1()
           
 void action10()
           
 boolean action10Guard()
           
 void action11()
           
 boolean action11Guard()
           
 void action12()
           
 boolean action12Guard()
           
 void action13()
           
 boolean action13Guard()
           
 void action14()
           
 boolean action14Guard()
           
 void action15()
           
 boolean action15Guard()
           
 void action16()
           
 boolean action16Guard()
           
 void action17()
           
 boolean action17Guard()
           
 void action18()
           
 boolean action18Guard()
           
 void action19()
           
 boolean action19Guard()
           
 boolean action1Guard()
           
 void action2()
           
 void action20()
           
 boolean action20Guard()
           
 boolean action2Guard()
           
 void action3()
           
 boolean action3Guard()
           
 void action4()
           
 boolean action4Guard()
           
 void action5()
           
 boolean action5Guard()
           
 void action6()
           
 boolean action6Guard()
           
 void action7()
           
 boolean action7Guard()
           
 void action8()
           
 boolean action8Guard()
           
 void action9()
           
 boolean action9Guard()
           
 java.lang.String getState()
          Return the current state of the FSM model.
static void main(java.lang.String[] args)
          This main method illustrates how we can use ModelJUnit to generate a small test suite.
 void reset(boolean testing)
          Reset the model to its initial state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecialFSMNoLoops

public SpecialFSMNoLoops()
Method Detail

getState

public java.lang.String getState()
Description copied from interface: FsmModel
Return the current state of the FSM model. The objects returned by this method define the states (the nodes) of the finite state machine. The objects that are returned must have a correct implementation of the equals method, since this is used to decide whether two states are the same or not. It is common to return a string, but other kinds of objects can be used if desired (in which case, their toString() method will be used to get a printable form of each FSM state).

Advanced Feature: This method can be used to define equivalence classes over the states, if you want to reduce the number of states to keep the FSM small. For example, if you have a integer state variable I that can have a huge number of possible values, you could define your getState() method to return new Integer(I % 10). This would reduce the FSM to just 10 states, where FSM state 0 represents all the states where I=0 or I=10 or I=20 etc., and FSM state 1 represents all the states where I=1 or I=11 or I=21 etc.

Specified by:
getState in interface FsmModel
Returns:
An object that represents the current state.

reset

public void reset(boolean testing)
Description copied from interface: FsmModel
Reset the model to its initial state. If the testing parameter is true, then this reset and all the following actions should affect the SUT.

Specified by:
reset in interface FsmModel
Parameters:
testing - true means the SUT should be reset too.

action0Guard

public boolean action0Guard()

action0

public void action0()

action1Guard

public boolean action1Guard()

action1

public void action1()

action2Guard

public boolean action2Guard()

action2

public void action2()

action3Guard

public boolean action3Guard()

action3

public void action3()

action4Guard

public boolean action4Guard()

action4

public void action4()

action5Guard

public boolean action5Guard()

action5

public void action5()

action6Guard

public boolean action6Guard()

action6

public void action6()

action7Guard

public boolean action7Guard()

action7

public void action7()

action8Guard

public boolean action8Guard()

action8

public void action8()

action9Guard

public boolean action9Guard()

action9

public void action9()

action10Guard

public boolean action10Guard()

action10

public void action10()

action11Guard

public boolean action11Guard()

action11

public void action11()

action12Guard

public boolean action12Guard()

action12

public void action12()

action13Guard

public boolean action13Guard()

action13

public void action13()

action14Guard

public boolean action14Guard()

action14

public void action14()

action15Guard

public boolean action15Guard()

action15

public void action15()

action16Guard

public boolean action16Guard()

action16

public void action16()

action17Guard

public boolean action17Guard()

action17

public void action17()

action18Guard

public boolean action18Guard()

action18

public void action18()

action19Guard

public boolean action19Guard()

action19

public void action19()

action20Guard

public boolean action20Guard()

action20

public void action20()

main

public static void main(java.lang.String[] args)
This main method illustrates how we can use ModelJUnit to generate a small test suite. If we had an implementation of this model that we wanted to test, we would extend each of the above methods so that they called the methods of the implementation and checked the results of those methods. We also report the transition coverage of the model.



Copyright © 2009 ModelJUnit Project. All Rights Reserved.