             forward: false
         )
         let content = Content(contentItems: [contentItem])
-        personalityInsights.profile(content: content, failure: failWithError) { profile in
+        personalityInsights.profile(content: content) {
+            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
+            }
+
             if let behaviors = profile.behavior {
                 for behavior in behaviors {
                     XCTAssertNotNil(behavior.traitID)


    func testProfileWithShortText() {
        let expectation = self.expectation(description: "profile(text:)")
        let failure = { (error: Error) in expectation.fulfill() }
        personalityInsights.profile(text: short, failure: failure, success: failWithResult)
        waitForExpectations()
    }
}

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

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