     }
 
     func testThatThrowingMapSubstitutesWithError() {
-        let beforeExpectation = expectationWithDescription("original task filled")
-        let beforeTask: Task<Int> = Task(value: -1)
-
-        let afterExpectation = expectationWithDescription("mapped filled with error")
-        let afterTask: Task<String> = beforeTask.map(upon: executor) { _ in
-            throw Error.Second
-        }
-
-        beforeTask.upon(executor) {
-            XCTAssertEqual($0.value, -1)
-            beforeExpectation.fulfill()
-        }
-
-        afterTask.upon(executor) {
+        let expectation = expectationWithDescription("mapped filled with error")
+        let task: Task<String> = anyFinishedTask.map(upon: executor) { _ in
+            throw Error.Second
+        }
+
+        task.upon(executor) {
             XCTAssertEqual($0.error as? Error, .Second)
-            afterExpectation.fulfill()
-        }
-
-        waitForExpectationsWithTimeout(TestTimeout, handler: nil)
-        assertExecutorCalled(3)
+            expectation.fulfill()
+        }
+
+        waitForExpectationsWithTimeout(TestTimeout, handler: nil)
+        assertExecutorCalled(2)
     }
 
     func testThatFlatMapForwardsCancellationToSubsequentTask() {
-        let beforeTask = Task<Int>(value: 1)
-
-        let afterExpectation = expectationWithDescription("flatMapped task is cancelled")
-        let afterTask: Task<String> = beforeTask.flatMap(upon: executor) { _ in
-            return Task(future: Future(), cancellation: afterExpectation.fulfill)
-        }
-
-        afterTask.cancel()
+        let expectation = expectationWithDescription("flatMapped task is cancelled")
+        let task: Task<String> = anyFinishedTask.flatMap(upon: executor) { _ in
+            return Task(future: Future(), cancellation: expectation.fulfill)
+        }
+
+        task.cancel()
 
         waitForExpectationsWithTimeout(TestTimeout, handler: nil)
         assertExecutorCalled(1)
     }
 
     func testThatThrowingFlatMapSubstitutesWithError() {
-        let beforeTask = Task<Int>(value: 1)
-
-        let afterExpectation = expectationWithDescription("flatMapped task is cancelled")
-        let afterTask = beforeTask.flatMap(upon: executor) { _ -> Task<String> in
-            throw Error.Second
-        }
-
-        afterTask.uponFailure {
+        let expectation = expectationWithDescription("flatMapped task is cancelled")
+        let task = anyFinishedTask.flatMap(upon: executor) { _ -> Task<String> in
+            throw Error.Second
+        }
+
+        task.uponFailure {
             XCTAssertEqual($0 as? Error, .Second)
-            afterExpectation.fulfill()
+            expectation.fulfill()
         }
 
         waitForExpectationsWithTimeout(TestTimeout, handler: nil)

    }

    func testThatThrowingMapSubstitutesWithError() {
        let beforeExpectation = expectationWithDescription("original task filled")
        let beforeTask: Task<Int> = Task(value: -1)

        let afterExpectation = expectationWithDescription("mapped filled with error")
        let afterTask: Task<String> = beforeTask.map(upon: queue) { _ in
            self.assertOnQueue()
            throw Error.Second
        }

        beforeTask.upon {
            XCTAssertEqual($0.value, -1)
            beforeExpectation.fulfill()
        }

        afterTask.upon {
            XCTAssertEqual($0.error as? Error, .Second)
            afterExpectation.fulfill()
        }

        waitForExpectationsWithTimeout(TestTimeout, handler: nil)
    }

    func testThatFlatMapForwardsCancellationToSubsequentTask() {
        let beforeTask = Task<Int>(value: 1)

        let afterExpectation = expectationWithDescription("flatMapped task is cancelled")
        let afterTask = beforeTask.flatMap(upon: queue) { _ -> Task<String> in
            self.assertOnQueue()
            return Task(future: Future(), cancellation: afterExpectation.fulfill)
        }

        afterTask.cancel()

        waitForExpectationsWithTimeout(TestTimeout, handler: nil)
    }

    func testThatThrowingFlatMapSubstitutesWithError() {
        let beforeTask = Task<Int>(value: 1)

        let afterExpectation = expectationWithDescription("flatMapped task is cancelled")
        let afterTask = beforeTask.flatMap(upon: queue) { _ -> Task<String> in
            throw Error.Second
        }

        afterTask.uponFailure {
            XCTAssertEqual($0 as? Error, .Second)
            afterExpectation.fulfill()
        }

        waitForExpectationsWithTimeout(TestTimeout, handler: nil)
    }

    func testThatRecoverMapsFailures() {
        let beforeExpectation = expectationWithDescription("original task filled")
        let beforeTask: Task<Int> = Task(error: Error.First)

        let afterExpectation = expectationWithDescription("mapped filled with same error")
        let afterTask: Task<Int> = beforeTask.recover(upon: queue) { _ in
            self.assertOnQueue()
            return 42
        }

        beforeTask.upon {
            XCTAssertEqual($0.error as? Error, .First)
            beforeExpectation.fulfill()
        }

        afterTask.upon {
            XCTAssertEqual($0.value, 42)
            afterExpectation.fulfill()
        }

        waitForExpectationsWithTimeout(TestTimeout, handler: nil)

    }

    func testUponFailure() {
        let (d, task) = anyUnfinishedTask
        let expectation = expectationWithDescription("upon is called")

        task.uponSuccess(queue, body: impossible)
