 
         let input = InputData(text: "Turn on the radio.")
         let request = MessageRequest(input: input, context: context!)
-        let response2 = ["Sure thing! Which genre would you prefer? Jazz is my personal favorite."]
-
-        assistant.message(workspaceID: workspaceID, request: request, failure: failWithError) {
-            response in
+        let result2 = ["Sure thing! Which genre would you prefer? Jazz is my personal favorite."]
+
+        assistant.message(workspaceID: workspaceID, request: request) {
+            response, error in
+
+            guard let result = response?.result else {
+                self.failPositiveTest(error)
+                return
+            }
 
             // verify input
-            XCTAssertEqual(response.input?.text, input.text)
+            XCTAssertEqual(result.input?.text, input.text)
 
             // verify context
-            XCTAssertEqual(response.context.conversationID, context!.conversationID)
-            XCTAssertNotNil(response.context.system)
-            XCTAssertNotNil(response.context.system!.additionalProperties)
-            XCTAssertFalse(response.context.system!.additionalProperties.isEmpty)
+            XCTAssertEqual(result.context.conversationID, context!.conversationID)
+            XCTAssertNotNil(result.context.system)
+            XCTAssertNotNil(result.context.system!.additionalProperties)
+            XCTAssertFalse(result.context.system!.additionalProperties.isEmpty)
 
             // verify entities
-            XCTAssertEqual(response.entities.count, 1)
-            XCTAssertEqual(response.entities[0].entity, "appliance")
-            XCTAssertEqual(response.entities[0].location[0], 12)
-            XCTAssertEqual(response.entities[0].location[1], 17)
-            XCTAssertEqual(response.entities[0].value, "music")
+            XCTAssertEqual(result.entities.count, 1)
+            XCTAssertEqual(result.entities[0].entity, "appliance")
+            XCTAssertEqual(result.entities[0].location[0], 12)
+            XCTAssertEqual(result.entities[0].location[1], 17)
+            XCTAssertEqual(result.entities[0].value, "music")
 
             // verify intents
-            XCTAssertEqual(response.intents.count, 1)
-            XCTAssertEqual(response.intents[0].intent, "turn_on")
-            XCTAssert(response.intents[0].confidence >= 0.80)
-            XCTAssert(response.intents[0].confidence <= 1.00)
+            XCTAssertEqual(result.intents.count, 1)
+            XCTAssertEqual(result.intents[0].intent, "turn_on")
+            XCTAssert(result.intents[0].confidence >= 0.80)
+            XCTAssert(result.intents[0].confidence <= 1.00)
 
             // verify output
-            XCTAssertTrue(response.output.logMessages.isEmpty)
-            XCTAssertEqual(response.output.text, response2)
-            XCTAssertNotNil(response.output.nodesVisited)
-            XCTAssertEqual(response.output.nodesVisited!.count, 3)
+            XCTAssertTrue(result.output.logMessages.isEmpty)
+            XCTAssertEqual(result.output.text, result2)
+            XCTAssertNotNil(result.output.nodesVisited)
+            XCTAssertEqual(result.output.nodesVisited!.count, 3)
 
             expectation2.fulfill()
         }

        let expectation = self.expectation(description: description)

        let newExample = "swift-sdk-test-counterexample" + UUID().uuidString
        assistant.createCounterexample(workspaceID: workspaceID, text: newExample, failure: failWithError) { counterexample in
            XCTAssertNotNil(counterexample.text)
            expectation.fulfill()
        }

        let description = "List all workspaces."
        let expectation = self.expectation(description: description)

        assistant.listWorkspaces(includeAudit: true) {
            response, error in

            guard let workspaceResult = response?.result else {
                self.failPositiveTest(error)
                return
            }

            for workspace in workspaceResult.workspaces {
                XCTAssertNotNil(workspace.name)
                XCTAssertNotNil(workspace.created)
                XCTAssertNotNil(workspace.updated)
                XCTAssertNotNil(workspace.language)
                XCTAssertNotNil(workspace.workspaceID)
            }
            XCTAssertNotNil(workspaceResult.pagination.refreshUrl)
            expectation.fulfill()
        }
        waitForExpectations()
