 
     func testListModelsBySourceLanguage() {
         let expectation = self.expectation(description: "List models, filtered by source language.")
-        languageTranslator.listModels(source: "es", failure: failWithError) { models in
+        languageTranslator.listModels(source: "es") {
+            response, error in
+
+            if let error = error {
+                XCTFail("Unexpected error response from service: \(error)")
+                return
+            }
+            guard let models = response?.result else {
+                XCTFail("Missing response value")
+                return
+            }
+
             XCTAssertGreaterThan(models.models.count, 0)
             expectation.fulfill()
         }


    func testIdentify() {
        let expectation = self.expectation(description: "Identify")
        languageTranslator.identify(text: "Hola", failure: failWithError) { identifiableLanguages in
            let languages = identifiableLanguages.languages
            XCTAssertGreaterThan(languages.count, 0)
            XCTAssertEqual(languages.first?.language, "es")


    func testListModelsByTargetLanguage() {
        let expectation = self.expectation(description: "List models, filtered by target language.")
        languageTranslator.listModels(target: "pt") {
            response, error in

            if let error = error {
                XCTFail("Unexpected error response from service: \(error)")
                return
            }
            guard let models = response?.result else {
                XCTFail("Missing response value")
                return
            }

            XCTAssertGreaterThan(models.models.count, 0)
            expectation.fulfill()
        }
