diff options
| -rw-r--r-- | packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt index 5c749e6e35d6..873357c2201e 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt @@ -21,8 +21,9 @@ import android.service.notification.StatusBarNotification import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase -import com.android.systemui.coroutines.collectLastValue -import com.android.systemui.kosmos.testScope +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.collectLastValue +import com.android.systemui.kosmos.runTest import com.android.systemui.statusbar.RankingBuilder import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.NotificationEntry @@ -35,7 +36,6 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock import com.android.systemui.util.mockito.whenever import com.google.common.truth.Truth.assertThat -import kotlinx.coroutines.test.runTest import org.junit.Test import org.junit.runner.RunWith @@ -43,17 +43,14 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class RenderNotificationsListInteractorTest : SysuiTestCase() { private val kosmos = testKosmos() - private val testScope = kosmos.testScope - private val notifsRepository = kosmos.activeNotificationListRepository - private val notifsInteractor = kosmos.activeNotificationsInteractor - private val underTest = - RenderNotificationListInteractor(notifsRepository, sectionStyleProvider = mock(), context) + private val Kosmos.outputInteractor by Kosmos.Fixture { activeNotificationsInteractor } + private val Kosmos.underTest by Kosmos.Fixture { renderNotificationListInteractor } @Test fun setRenderedList_preservesOrdering() = - testScope.runTest { - val notifs by collectLastValue(notifsInteractor.topLevelRepresentativeNotifications) + kosmos.runTest { + val notifs by collectLastValue(outputInteractor.topLevelRepresentativeNotifications) val keys = (1..50).shuffled().map { "$it" } val entries = keys.map { mockNotificationEntry(key = it) } underTest.setRenderedList(entries) @@ -65,8 +62,8 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test fun setRenderList_flatMapsRankings() = - testScope.runTest { - val ranks by collectLastValue(notifsInteractor.activeNotificationRanks) + kosmos.runTest { + val ranks by collectLastValue(outputInteractor.activeNotificationRanks) val single = mockNotificationEntry("single", 0) val group = @@ -90,8 +87,8 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test fun setRenderList_singleItems_mapsRankings() = - testScope.runTest { - val actual by collectLastValue(notifsInteractor.activeNotificationRanks) + kosmos.runTest { + val actual by collectLastValue(outputInteractor.activeNotificationRanks) val expected = (0..10).shuffled().mapIndexed { index, value -> "$value" to index }.toMap() @@ -104,8 +101,8 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test fun setRenderList_groupWithNoSummary_flatMapsRankings() = - testScope.runTest { - val actual by collectLastValue(notifsInteractor.activeNotificationRanks) + kosmos.runTest { + val actual by collectLastValue(outputInteractor.activeNotificationRanks) val expected = (0..10).shuffled().mapIndexed { index, value -> "$value" to index }.toMap() @@ -124,8 +121,8 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun setRenderList_setsPromotionContent() = - testScope.runTest { - val actual by collectLastValue(notifsInteractor.topLevelRepresentativeNotifications) + kosmos.runTest { + val actual by collectLastValue(outputInteractor.topLevelRepresentativeNotifications) val notPromoted1 = mockNotificationEntry("key1", promotedContent = null) val promoted2 = |