xref: /aosp14/frameworks/base/packages/SystemUI/tests/src/com/android/systemui/coroutines/FlowTest.kt
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.coroutines
2 
3 import android.testing.AndroidTestingRunner
4 import androidx.test.filters.SmallTest
5 import com.android.systemui.SysuiTestCase
6 import com.google.common.truth.Truth.assertThat
7 import kotlinx.coroutines.ExperimentalCoroutinesApi
8 import kotlinx.coroutines.flow.flowOf
9 import kotlinx.coroutines.test.runTest
10 import org.junit.Test
11 import org.junit.runner.RunWith
12 
13 @OptIn(ExperimentalCoroutinesApi::class)
14 @SmallTest
15 @RunWith(AndroidTestingRunner::class)
16 class FlowTest : SysuiTestCase() {
17 
18     @Test
19     fun collectLastValue() = runTest {
20         val flow = flowOf(0, 1, 2)
21         val lastValue by collectLastValue(flow)
22         assertThat(lastValue).isEqualTo(2)
23     }
24 }
25 

闽ICP备2022004144号-1闽公网安备35021102001383号

OpenHarmony source code served by {OpenGrok Contact:jevonbin@qq.com