         ]
     }
 
-    /** Instantiate Natural Langauge Classifier instance. */
+    /** Instantiate Natural Langauge response, error in
+
+            if let error = error {
+                XCTFail("Unexpected error response from service: \(error)")
+                return
+            }
+            guard let classifier = response?.result else {
+                XCTFail("Missing response value")
+                return
+            }
+stance. */
     func instantiateNaturalLanguageClassifier() {
         if let apiKey = Credentials.NaturalLanguageClassifierAPIKey {
             naturalLanguageClassifier = NaturalLanguageClassifier(apiKey: apiKey)


    func testListClassifiers() {
        let expectation = self.expectation(description: "Get classifiers.")
        naturalLanguageClassifier.listClassifiers(failure: failWithError) { classifiers in
            XCTAssertGreaterThan(classifiers.classifiers.count, 0)
            expectation.fulfill()
        }


    func testCreateClassifierWithMissingMetadata() {
        let expectation = self.expectation(description: "Create a classifier with missing metadata")
        naturalLanguageClassifier.createClassifier(
            metadata: metadataFileEmpty,
            trainingData: trainingFile
        ) {
                _, error in

                if error == nil {
                    XCTFail("Expected error response")
                }
                expectation.fulfill()
        }
        waitForExpectations()
    }

    func testClassifyEmptyString() {
        let expectation = self.expectation(description: "Classify and empty string.")
        naturalLanguageClassifier.classify(classifierID: trainedClassifierId, text: "") {
            _, error in

            if error == nil {
                XCTFail("Expected error response")
            }
            expectation.fulfill()
        }
        waitForExpectations()
    }

    func testClassifyWithInvalidClassifier() {
        let expectation = self.expectation(description: "Classify using an invalid classifier id.")
        naturalLanguageClassifier.classify(
            classifierID: "this-is-an-invalid-classifier-id",
            text: "How hot will it be today?"
        ) {
            _, error in

            if error == nil {
                XCTFail("Expected error response")
            }
            expectation.fulfill()
        }
        waitForExpectations()
    }

    func testDeleteInvalidClassifier() {
        let expectation = self.expectation(description: "Delete a classifier using an invalid classifier id.")
        naturalLanguageClassifier.deleteClassifier(
            classifierID: "this-is-an-invalid-classifier-id"
        ) {
            _, error in

            if error == nil {
                XCTFail("Expected error response")
            }
            expectation.fulfill()
        }
        waitForExpectations()
    }

    func testGetInvalidClassifier() {
        let expectation = self.expectation(description: "Get classifier using an invalid classifier id.")
        naturalLanguageClassifier.getClassifier(
            classifierID: "this-is-an-invalid-classifier-id"
        ) {
            _, error in

            if error == nil {
                XCTFail("Expected error response")
            }
            expectation.fulfill()
        }
        waitForExpectations()
    }
}
