     }
 
     func testSearchSucceedsWithInvalidJSONAfterGuestLoginSucceedsNotifiesHandlerOfFailure() {
-        var controllableNetworkAdapter = ControllableNetworkAdapter()
-        controllableNetworkAdapter.stub(url: URL(string: "https://inkbunny.net/api_login.php")!, withContentsOfJSONFile: "ValidInkbunnyGuestLoginResponse")
-        let invalidJSON = "{what!".data(using: .utf8)!
-        controllableNetworkAdapter.stub(url: URL(string: "https://inkbunny.net/api_search.php?sid=This_Is_A_Test_Token")!, with: invalidJSON)
-        let inkbunnyAPI = InkbunnyAPI(networkAdapter: controllableNetworkAdapter)
+        let failingSearchNetworkAdapter = makeFailingSearchNetworkAdapter()
+        let inkbunnyAPI = InkbunnyAPI(networkAdapter: failingSearchNetworkAdapter)
         let capturingHomepageHandler = CapturingInkbunnyHomepageHandler()
         inkbunnyAPI.loadHomepage(completionHandler: capturingHomepageHandler.verify)
 


class InkbunnyAPITests: XCTestCase {

    func testAttemptingToFetchHomepageWhenNotLoggedInGetsLoginEndpoint() {
        let expectedLoginURL = URL(string: "https://inkbunny.net/api_login.php")!
        let capturingNetworkAdapter = CapturingNetworkAdapter()


    func testSearchSucceedsProvidesHandlerWithSecondItemConfiguredWithSubmissionID() {
        let secondSubmissionIDInSearchJSON = "1359473"
        let happyPathNetworkAdapter = makeSuccessfulSearchNetworkAdapter()
        let inkbunnyAPI = InkbunnyAPI(networkAdapter: happyPathNetworkAdapter)
        let capturingHomepageHandler = CapturingInkbunnyHomepageHandler()
        inkbunnyAPI.loadHomepage(completionHandler: capturingHomepageHandler.verify)

