             if (state == ElasticMotionState.Opened) {
                 self.expectation?.fulfill()
             }
+        } else if (self.expectation?.description == openToRight_MayOpenThenStop) {
+            if (state == ElasticMotionState.Closed) {
+                self.expectation?.fulfill()
+            }
         }
     }
     

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

        }
    }
    
    func testOpenToRightMayOpenThenStop() {
        self.stateMachine = ElasticMotionStateMachine(ElasticMotionDirection.Right, threshold: 50.0, vibrationSec: vibrationSec)
        self.stateMachine?.delegate = self
        
        self.expectation = expectationWithDescription(openToRight_MayOpenThenStop)
        
        if let stateMachine = self.stateMachine {
            stateMachine.keepMoving(CGPointMake(0, 10))
            stateMachine.stopMoving()
            
            waitForExpectationsWithTimeout(0.1) { error in
                if let error = error {
                    XCTFail("Error: \(error.localizedDescription)")
                }
            }
        }
    }
    
    func testOpenToRightWillOpen() {
        self.stateMachine = ElasticMotionStateMachine(ElasticMotionDirection.Right, threshold: 50.0, vibrationSec: vibrationSec)
        self.stateMachine?.delegate = self
        
        self.expectation = expectationWithDescription(openToRight_WillOpen)

        if let stateMachine = self.stateMachine {
