     
     func testFailedAndThen() {
         let future = Future<Bool>()
-        let expectationAndThen = expectationWithDescription("OnSuccess fulfilled for mapped future")
-        let expectationAndThenOnFailure = expectationWithDescription("OnSuccess fulfilled for mapped future")
+        let expectationAndThen = expectationWithDescription("andThen handler fulfilled")
+        let expectationAndThenOnFailure = expectationWithDescription("OnFailure fulfilled for andThen future")
         let expectation = expectationWithDescription("OnSuccess fulfilled")
         future.onSuccess {value in
             XCTAssert(false, "future onSuccess value invalid")

    
    func testSuccessfulAndThen() {
        let future = Future<Bool>()
        let expectationAndThen = expectationWithDescription("OnSuccess fulfilled for mapped future")
        let expectationAndThenOnSuccess = expectationWithDescription("OnSuccess fulfilled for mapped future")
        let expectation = expectationWithDescription("OnSuccess fulfilled")
        future.onSuccess {value in
            XCTAssert(value, "future onSuccess value invalid")

    
}

class FutureRecoverTests : XCTestCase {
    
    override func setUp() {
        super.setUp()
    }
    
    override func tearDown() {
        super.tearDown()
    }
    
    func testSuccessful() {
        let future = Future<Bool>()
        let expectationRecovery = expectationWithDescription("OnSuccess fulfilled for recovered future")
        let expectation = expectationWithDescription("OnSuccess fulfilled")
        future.onSuccess {value in
            XCTAssert(value, "future onSuccess value invalid")
            expectation.fulfill()
        }
        future.onFailure {error in
            XCTAssert(false, "future onFailure called")
        }
        let recovered = future.recover {error -> Try<Bool> in
            XCTAssert(false, "recover called")
            return Try(false)
        }
        recovered.onSuccess {value in
            XCTAssert(value, "recovered onSuccess value invalid")
            expectationRecovery.fulfill()
        }
        recovered.onFailure {error in
            XCTAssert(false, "recovered onFailure called")
        }
        future.success(true)
        waitForExpectationsWithTimeout(2) {error in
            XCTAssertNil(error, "\(error)")
        }
    }

//    func testSuccessfulRecovery() {
//        let future = Future<Bool>()
//        let expectationRecovery = expectationWithDescription("OnSuccess fulfilled for recovered future")
//        let expectation = expectationWithDescription("OnSuccess fulfilled")
//        future.onSuccess {value in
//            XCTAssert(value, "future onSuccess value invalid")
//            expectation.fulfill()
//        }
//        future.onFailure {error in
//            XCTAssert(false, "future onFailure called")
//        }
//        let mapped = future.flatmap {value -> Future<Int> in
//            let promise = Promise<Int>()
//            promise.success(1)
//            return promise.future
//        }
//        mapped.onSuccess {value in
//            XCTAssertEqual(value, 1, "mapped onSuccess value invalid")
//            expectationMapped.fulfill()
//        }
//        mapped.onFailure {error in
//            XCTAssert(false, "mapped onFailure called")
//        }
//        future.success(true)
//        waitForExpectationsWithTimeout(2) {error in
//            XCTAssertNil(error, "\(error)")
//        }
//    }
//
//    func testFailedRecovery() {
//        let future = Future<Bool>()
//        let expectationMapped = expectationWithDescription("OnFailure fulfilled for mapped future")
//        let expectation = expectationWithDescription("OnSuccess fulfilled")
//        future.onSuccess {value in
//            XCTAssert(value, "future onSuccess value invalid")
//            expectation.fulfill()
//        }
//        future.onFailure {error in
//            XCTAssert(false, "future onFailure called")
//        }
//        let mapped = future.flatmap {value -> Future<Int> in
//            let promise = Promise<Int>()
//            promise.failure(TestFailure.error)
//            return promise.future
//        }
//        mapped.onSuccess {value in
//            XCTAssert(false, "mapped onSuccess called")
//        }
//        mapped.onFailure {error in
//            expectationMapped.fulfill()
//        }
//        future.success(true)
//        waitForExpectationsWithTimeout(2) {error in
//            XCTAssertNil(error, "\(error)")
//        }
//    }
    
}

