diff --git a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/UnarySnapshotTests.kt b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/UnarySnapshotTests.kt index 6749a31e952..66e6a3f53a5 100644 --- a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/UnarySnapshotTests.kt +++ b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/UnarySnapshotTests.kt @@ -35,6 +35,7 @@ import io.kotest.matchers.types.shouldBeInstanceOf import io.ktor.http.HttpStatusCode import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.withTimeout +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.Serializable import kotlinx.serialization.json.JsonPrimitive import org.junit.Test @@ -44,6 +45,7 @@ import org.junit.Test internal class UnarySnapshotTests { private val testTimeout = 5.seconds + @OptIn(ExperimentalSerializationApi::class) @Test fun `short reply`() = goldenUnaryFile("success-basic-reply-short.json") { @@ -57,6 +59,7 @@ internal class UnarySnapshotTests { } } + @OptIn(ExperimentalSerializationApi::class) @Test fun `long reply`() = goldenUnaryFile("success-basic-reply-long.json") { @@ -219,6 +222,7 @@ internal class UnarySnapshotTests { } } + @OptIn(ExperimentalSerializationApi::class) @Test fun `properly translates json text`() = goldenUnaryFile("success-constraint-decoding-json.json") { @@ -305,6 +309,7 @@ internal class UnarySnapshotTests { } } + @OptIn(ExperimentalSerializationApi::class) @Test fun `function call contains null param`() = goldenUnaryFile("success-function-call-null.json") { @@ -317,6 +322,7 @@ internal class UnarySnapshotTests { } } + @OptIn(ExperimentalSerializationApi::class) @Test fun `function call contains json literal`() = goldenUnaryFile("success-function-call-json-literal.json") { @@ -335,6 +341,7 @@ internal class UnarySnapshotTests { } } + @OptIn(ExperimentalSerializationApi::class) @Test fun `function call has no arguments field`() = goldenUnaryFile("success-function-call-empty-arguments.json") { diff --git a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/util/tests.kt b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/util/tests.kt index db42d791c30..8d1e3bf9f00 100644 --- a/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/util/tests.kt +++ b/firebase-vertexai/src/test/java/com/google/firebase/vertexai/common/util/tests.kt @@ -38,6 +38,7 @@ import io.ktor.utils.io.close import io.ktor.utils.io.writeFully import java.io.File import kotlinx.coroutines.launch +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.encodeToString private val TEST_CLIENT_ID = "genai-android/test" @@ -48,6 +49,7 @@ internal fun prepareStreamingResponse(response: List): internal fun prepareResponse(response: GenerateContentResponse) = JSON.encodeToString(response).toByteArray() +@OptIn(ExperimentalSerializationApi::class) internal fun createRequest(vararg text: String): GenerateContentRequest { val contents = text.map { Content(parts = listOf(TextPart(it))) } @@ -56,6 +58,7 @@ internal fun createRequest(vararg text: String): GenerateContentRequest { internal fun createResponse(text: String) = createResponses(text).single() +@OptIn(ExperimentalSerializationApi::class) internal fun createResponses(vararg text: String): List { val candidates = text.map { Candidate(Content(parts = listOf(TextPart(it)))) }