Renamed stateMachine to StateMachine and put assertion on events