 
     func testProfileHTML() {
         let expectation = self.expectation(description: "profile(html:)")
-        personalityInsights.profile(html: html, failure: failWithError) { profile in
+        personalityInsights.profile(html: html) {
+            response, error in
+
+            if let error = error {
+                XCTFail("Unexpected error response from service: \(error)")
+                return
+            }
+            guard let profile = response?.result else {
+                XCTFail("Missing response value")
+                return
+            }
+
             for preference in profile.personality {
                 XCTAssertNotNil(preference.name)
                 break


    func testProfileText() {
        let expectation = self.expectation(description: "profile(text:)")
        personalityInsights.profile(text: text, failure: failWithError) { profile in
            for preference in profile.personality {
                XCTAssertNotNil(preference.name)
                break

        self.short = load(forResource: "MobyDickIntro", ofType: "txt")
    }

    /** Wait for expectations. */
    func waitForExpectations(timeout: TimeInterval = 5.0) {
        waitForExpectations(timeout: timeout) { error in
