     }
     
     func testOpenToRightOpened() {
+        self.stateMachine = ElasticMotionStateMachine(ElasticMotionDirection.Right, threshold: 50.0, vibrationSec: vibrationSec)
+        self.stateMachine?.delegate = self
+        
         self.expectation = expectationWithDescription(openToRight_Opened)
         
         if let stateMachine = self.stateMachine {

        }
    }
    
    func testOpenToRightWillOpen() {
        self.expectation = expectationWithDescription(openToRight_WillOpen)

        if let stateMachine = self.stateMachine {

    let openToRight_MayOpen = "openToRight_MayOpen"
    let openToRight_WillOpen = "openToRight_WillOpen"
    let openToRight_Opened = "openToRight_Opened"
    let openToRight_MayOpenThenStop = "openToRight_MayOpenThenStop"
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        self.stateMachine = nil
        
        super.tearDown()
    }
    
    func testOpenToRightMayOpen() {
        self.stateMachine = ElasticMotionStateMachine(ElasticMotionDirection.Right, threshold: 50.0, vibrationSec: vibrationSec)
        self.stateMachine?.delegate = self
        
        self.expectation = expectationWithDescription(openToRight_MayOpen)
        
        if let stateMachine = self.stateMachine {
