-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathGoogleMapsInitializerTest.kt
More file actions
34 lines (28 loc) · 1.15 KB
/
GoogleMapsInitializerTest.kt
File metadata and controls
34 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.google.maps.android.compose
import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.google.common.truth.Truth.assertThat
import com.google.maps.android.compose.internal.GoogleMapsInitializer
import com.google.maps.android.compose.internal.InitializationState
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
import org.junit.After
import org.junit.Test
import org.junit.runner.RunWith
@OptIn(ExperimentalCoroutinesApi::class)
@RunWith(AndroidJUnit4::class)
class GoogleMapsInitializerTest {
@After
fun tearDown() = runTest {
GoogleMapsInitializer.reset()
}
@Test
fun testInitializationSuccess() = runTest {
// In an instrumentation test environment, Google Play services are available.
// Therefore, we expect the initialization to succeed.
val context: Context = InstrumentationRegistry.getInstrumentation().targetContext
GoogleMapsInitializer.initialize(context)
assertThat(GoogleMapsInitializer.state.value).isEqualTo(InitializationState.SUCCESS)
}
}