         button.imageObserver = {
             highlightedStateImageDownloadComplete = true
             expectation3.fulfill()
-        } as (() -> Void)
+        }
 
         waitForExpectations(timeout: timeout, handler: nil)
 

        button.imageObserver = {
            normalStateBackgroundImageDownloadComplete = true
            expectation1.fulfill()
        } as (() -> Void)

        waitForExpectations(timeout: timeout, handler: nil)
        let expectation2 = expectation(description: "background image should download successfully")

            imageDownloadComplete = true
            finalImageEqualsPlaceholderImage = button.image(for:[]) === placeholderImage
            expectation.fulfill()
        }

        waitForExpectations(timeout: timeout, handler: nil)

