         }
         waitForExpectations()
     }
- 
+
     func testCreateAndDeleteCounterexample() {
         let description = "Create a new counterexample."
         let expectation = self.expectation(description: description)
-        
+
         let newExample = "swift-sdk-test-counterexample" + UUID().uuidString
         conversation.createCounterexample(workspaceID: workspaceID, text: newExample, failure: failWithError) { counterexample in
             XCTAssertNotNil(counterexample.created)

    }

    // MARK: - Positive Tests
    
    func testMessage() {
        let description1 = "Start a conversation."
        let expectation1 = self.expectation(description: description1)
        
        let response1 = ["Hi. It looks like a nice drive today. What would you like me to do?"]
        let nodes1 = ["node_1_1467221909631"]
        
        var context: Context?
        conversation.message(withWorkspace: workspaceID, failure: failWithError) {
            response in
            
            // verify input
            XCTAssertNil(response.input)
            
            // verify context
            XCTAssertNotNil(response.context.conversationID)
            XCTAssertNotEqual(response.context.conversationID, "")
            XCTAssertNotNil(response.context.system)
            //XCTAssertEqual(response.context.system.dialogStack, ["root"])
            XCTAssertEqual(response.context.system.dialogTurnCounter, 1)
            XCTAssertEqual(response.context.system.dialogRequestCounter, 1)
            
            // verify entities
            XCTAssertTrue(response.entities.isEmpty)
            
            // verify intents
            XCTAssertTrue(response.intents.isEmpty)
            
            // verify output
            XCTAssertTrue(response.output.logMessages.isEmpty)
            XCTAssertEqual(response.output.text, response1)
            XCTAssertEqual(response.output.nodesVisited, nodes1)
            
            context = response.context
            expectation1.fulfill()
        }
        waitForExpectations()
        
        let description2 = "Continue a conversation."
        let expectation2 = self.expectation(description: description2)
        
        let text = "Turn on the radio."
        let request = MessageRequest(text: text, context: context!)
        let response2 = ["", "Sure thing! Which genre would you prefer? Jazz is my personal favorite.."]
        let nodes2 = ["node_1_1467232431348", "node_2_1467232480480", "node_1_1467994455318"]
        
        conversation.message(withWorkspace: workspaceID, request: request, failure: failWithError) {
            response in
            
            // verify input
            XCTAssertEqual(response.input!.text, text)
            
            // verify context
            XCTAssertEqual(response.context.conversationID, context!.conversationID)
            XCTAssertNotNil(response.context.system)
            //XCTAssertEqual(response.context.system.dialogStack, ["node_1_1467994455318"])
            XCTAssertEqual(response.context.system.dialogTurnCounter, 2)
            XCTAssertEqual(response.context.system.dialogRequestCounter, 2)
            
            // verify entities
            XCTAssertEqual(response.entities.count, 1)
            XCTAssertEqual(response.entities[0].entity, "appliance")
            XCTAssertEqual(response.entities[0].startIndex, 12)
            XCTAssertEqual(response.entities[0].endIndex, 17)
            XCTAssertEqual(response.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)
            
            // verify output
            XCTAssertTrue(response.output.logMessages.isEmpty)
            XCTAssertEqual(response.output.text, response2)
            XCTAssertEqual(response.output.nodesVisited, nodes2)
            
            expectation2.fulfill()
        }
        waitForExpectations()
    }
    
    func testMessageAllFields1() {
        let description1 = "Start a conversation."
        let expectation1 = expectation(description: description1)
        
        var context: Context?
        var entities: [Entity]?
        var intents: [Intent]?
        var output: Output?
        
        conversation.message(withWorkspace: workspaceID, failure: failWithError) {
            response in
            context = response.context
            entities = response.entities

import ConversationV1

class ConversationTests: XCTestCase {

    private var conversation: Conversation!
    private let workspaceID = Credentials.ConversationWorkspace

    // MARK: - Test Configuration

