Skip to content

Commit c59fa50

Browse files
Add tests for HarmBlockMethod compatibility with GoogleAI and VertexAI
Added unit tests to `GenerativeModelTesting.kt` to verify that: 1. Using `HarmBlockMethod` with `GoogleAI` backend throws `InvalidStateException`. 2. Using `HarmBlockMethod` with `VertexAI` backend does not throw `InvalidStateException`. This covers an edge case where `HarmBlockMethod` is only supported by VertexAI.
1 parent 09a7c24 commit c59fa50

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

firebase-ai/src/test/java/com/google/firebase/ai/GenerativeModelTesting.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ internal class GenerativeModelTesting {
193193
)
194194

195195
val exception =
196-
shouldThrow<InvalidStateException> {
197-
generativeModel.generateContent("my test prompt")
198-
}
196+
shouldThrow<InvalidStateException> { generativeModel.generateContent("my test prompt") }
199197

200198
exception.message shouldContain "HarmBlockMethod is unsupported by the Google Developer API"
201199
}

0 commit comments

Comments
 (0)