Add State Machine definitions and tests