     func validateSTTResult(result: SpeechToTextResult, settings: SpeechToTextSettings) {
 
         XCTAssertNotNil(result.final)
+        let final = result.final!
+
         XCTAssertNotNil(result.alternatives)
-
-        let final = result.final!
-
         for alternative in result.alternatives {
             validateSTTTranscription(alternative, final: final, settings: settings)
         }
 
-        if final && settings.keywords?.count > 0 {
+        if settings.keywords?.count > 0 && final {
+            XCTAssertNotNil(settings.keywordsThreshold)
             XCTAssertGreaterThanOrEqual(settings.keywordsThreshold!, 0.0)
             XCTAssertLessThanOrEqual(settings.keywordsThreshold!, 1.0)
             XCTAssertNotNil(result.keywordResults)
             XCTAssertGreaterThan(result.keywordResults!.count, 0)
             for (keyword, keywordResults) in result.keywordResults! {
-                validateSTTKeywordResult(keyword, keywordResults: keywordResults)
-            }
-        }
-
-        if final && settings.wordAlternativesThreshold != nil {
+                validateSTTKeywordResults(keyword, keywordResults: keywordResults)
+            }
+        } else if settings.keywords?.count > 0 && !final {
+            XCTAssertEqual(result.keywordResults!.count, 0)
+        } else {
+            XCTAssertNil(result.keywordResults)
+        }
+
+        if settings.wordAlternativesThreshold != nil && final {
+            XCTAssertNotNil(settings.wordAlternativesThreshold)
             XCTAssertGreaterThanOrEqual(settings.wordAlternativesThreshold!, 0.0)
             XCTAssertLessThanOrEqual(settings.wordAlternativesThreshold!, 1.0)
             XCTAssertNotNil(result.wordAlternatives)
             XCTAssertGreaterThan(result.wordAlternatives!.count, 0)
-            for word in result.wordAlternatives! {
-                validateSTTWordAlternativeResults(word)
-            }
+            for wordAlternatives in result.wordAlternatives! {
+                validateSTTWordAlternativeResults(wordAlternatives)
+            }
+        } else if settings.wordAlternativesThreshold != nil && !final {
+            XCTAssertEqual(result.wordAlternatives!.count, 0)
+        } else {
+            XCTAssertNil(result.wordAlternatives)
         }
     }
 

            XCTAssertNil(transcription.timestamps)
        }

        if final && settings.wordConfidence == true {
            XCTAssertNotNil(transcription.wordConfidence)
            for word in transcription.wordConfidence! {
                validateSTTWordConfidence(word)
            }
        } else {
            // TODO: perhaps this is empty instead of nil when wordConfidence == false?
            XCTAssertNil(transcription.wordConfidence)
        }
    }

    func validateSTTWordTimestamp(timestamp: SpeechToTextWordTimestamp) {
        XCTFail("Needs to be implemented.")
    }

    func validateSTTWordConfidence(word: SpeechToTextWordConfidence) {
        XCTFail("Needs to be implemented.")
    }

    func validateSTTKeywordResult(keyword: String, keywordResults: [SpeechToTextKeywordResult]) {
        XCTFail("Needs to be implemented.")
    }

    func validateSTTWordAlternativeResults(word: SpeechToTextWordAlternativeResults) {
        XCTFail("Needs to be implemented.")
    }

    // TODO: Test a foreign language.

        XCTAssertNotNil(transcription.transcript)
        XCTAssertGreaterThan(transcription.transcript!.characters.count, 0)

        // TODO: only available for best alterantive, but this checks all...
        // TODO: write a test that returns multiple alternatives, forcing this to fail...
        // TODO: perhaps here I can just check that 0.0 <= confidence <= 1.0 if the confidence
        //          is non-nil. elsewhere, I can check that exactly one alternative has confidence
        //          set.

        if final {
            XCTAssertNotNil(transcription.confidence)
            XCTAssertGreaterThanOrEqual(transcription.confidence!, 0.0)
