diff --git a/common/src/test/java/com/google/ai/client/generativeai/common/StreamingSnapshotTests.kt b/common/src/test/java/com/google/ai/client/generativeai/common/StreamingSnapshotTests.kt index 7f151320..656a5eb4 100644 --- a/common/src/test/java/com/google/ai/client/generativeai/common/StreamingSnapshotTests.kt +++ b/common/src/test/java/com/google/ai/client/generativeai/common/StreamingSnapshotTests.kt @@ -72,11 +72,13 @@ internal class StreamingSnapshotTests { val responses = apiController.generateContentStream(textGenerateContentRequest("prompt")) withTimeout(testTimeout) { - responses.first { + val responseList = responses.toList() + responseList.isEmpty() shouldBe false + responseList.any { it.candidates?.any { it.safetyRatings?.any { it.category == HarmCategory.UNKNOWN } ?: false } ?: false - } + } shouldBe true } }