 //        future.onFailure {error in
 //            expectation.fulfill()
 //        }
-//        let mapped = future.map {value -> Try<Int> in
+//        let mapped = future.flatmap {value -> Future<Int> in
 //            XCTAssert(false, "mapping called")
-//            return Try(Int(1))
+//            let promise = Promise<Int>()
+//            promise.success(1)
+//            return promise.future
 //        }
 //        mapped.onSuccess {value in
 //            XCTAssert(false, "mapped onSuccess called")

//        }
//    }
//    
//    func testMappingToFailedFuture() {
//        let future = Future<Bool>()
//        let expectationMapped = expectationWithDescription("OnFailure fulfilled for mapped future")
//        let expectation = expectationWithDescription("OnFailure fulfilled")

//        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")
