         button.imageObserver = {
             normalStateBackgroundImageDownloadComplete = true
             expectation1.fulfill()
-        } as (() -> Void)
+        }
 
         waitForExpectations(timeout: timeout, handler: nil)
         let expectation2 = expectation(description: "background image should download successfully")

        button.imageObserver = {
            disabledStateImageDownloadComplete = true
            expectation4.fulfill()
        } as (() -> Void)

        waitForExpectations(timeout: timeout, handler: nil)


        button.imageObserver = {
            normalStateImageDownloadComplete = true
            expectation1.fulfill()
        }

        waitForExpectations(timeout: timeout, handler: nil)

