Move generating state machine from DSL file into StateMachine.
Add Unit Test.