File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
src/test/java/com/google/firebase/ai/type Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,6 @@ dependencies {
123
123
testImplementation(libs.robolectric)
124
124
testImplementation(libs.truth)
125
125
testImplementation(libs.mockito.core)
126
- testImplementation(libs.mockito.kotlin)
127
126
testImplementation(libs.ktor.client.mock)
128
127
129
128
androidTestImplementation(libs.androidx.espresso.core)
Original file line number Diff line number Diff line change @@ -5,21 +5,19 @@ import android.content.pm.PackageManager
5
5
import com.google.firebase.FirebaseApp
6
6
import com.google.firebase.ai.util.doBlocking
7
7
import io.kotest.assertions.throwables.shouldThrow
8
- import io.ktor.client.plugins.websocket.testing.*
8
+ import io.ktor.client.plugins.websocket.testing.EmptyWebSockets
9
9
import kotlinx.coroutines.Dispatchers
10
10
import org.junit.Test
11
- import org.mockito.kotlin.*
11
+ import org.mockito.Mockito
12
12
13
13
class LiveSessionTest {
14
14
15
15
@Test
16
16
fun `startAudioConversation without permission throws exception` () = doBlocking {
17
- val mockContext = mock<Context > {
18
- on { checkSelfPermission(android.Manifest .permission.RECORD_AUDIO ) } doReturn PackageManager .PERMISSION_DENIED
19
- }
20
- val mockFirebaseApp = mock<FirebaseApp > {
21
- on { applicationContext } doReturn mockContext
22
- }
17
+ val mockContext = Mockito .mock(Context ::class .java)
18
+ Mockito .`when `(mockContext.checkSelfPermission(android.Manifest .permission.RECORD_AUDIO )).thenReturn(PackageManager .PERMISSION_DENIED )
19
+ val mockFirebaseApp = Mockito .mock(FirebaseApp ::class .java)
20
+ Mockito .`when `(mockFirebaseApp.applicationContext).thenReturn(mockContext)
23
21
val session = LiveSession (
24
22
session = EmptyWebSockets .client.session,
25
23
blockingDispatcher = Dispatchers .IO ,
You can’t perform that action at this time.
0 commit comments