 
     func testProfileAsCsvText() {
         let expectation = self.expectation(description: "profile(text:)")
-        personalityInsights.profileAsCsv(text: text, failure: failWithError) { csv in
+        personalityInsights.profileAsCsv(text: text) {
+            response, error in
+
+            if let error = error {
+                XCTFail("Unexpected error response from service: \(error)")
+                return
+            }
+            guard let csv = response?.result else {
+                XCTFail("Missing response value")
+                return
+            }
+
             XCTAssertGreaterThan(csv.count, 0)
             expectation.fulfill()
         }


    func testProfileAsCsvHTML() {
        let expectation = self.expectation(description: "profile(html:)")
        personalityInsights.profileAsCsv(html: html, failure: failWithError) { csv in
            XCTAssertGreaterThan(csv.count, 0)
            expectation.fulfill()
        }


    func testProfileText() {
        let expectation = self.expectation(description: "profile(text:)")
        personalityInsights.profile(text: text) {
            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
