[Notif] HeadsUpManagerImplTest: Remove Assert, remove Hungarian notation
Bug: 378142453
Flag: EXEMPT refactor
Test: atest HeadsUpManagerImplOldTest HeadsUpManagerImplTest
Change-Id: I9e06ca2b7902af67b3a33d812c404904d7d0751d
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplOldTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplOldTest.kt
index d2a7c61..8b4f53a 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplOldTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplOldTest.kt
@@ -81,9 +81,9 @@
@Mock private val mAccessibilityMgr: AccessibilityManagerWrapper? = null
- protected val mGlobalSettings: FakeGlobalSettings = FakeGlobalSettings()
- protected val mSystemClock: FakeSystemClock = FakeSystemClock()
- protected val mExecutor: FakeExecutor = FakeExecutor(mSystemClock)
+ protected val globalSettings: FakeGlobalSettings = FakeGlobalSettings()
+ protected val systemClock: FakeSystemClock = FakeSystemClock()
+ protected val executor: FakeExecutor = FakeExecutor(systemClock)
@Mock protected var mRow: ExpandableNotificationRow? = null
@@ -96,10 +96,10 @@
GroupMembershipManagerImpl(),
mKosmos.visualStabilityProvider,
mKosmos.configurationController,
- mockExecutorHandler(mExecutor),
- mGlobalSettings,
- mSystemClock,
- mExecutor,
+ mockExecutorHandler(executor),
+ globalSettings,
+ systemClock,
+ executor,
mAccessibilityMgr,
mUiEventLoggerFake,
JavaAdapter(mKosmos.testScope),
@@ -247,7 +247,7 @@
val entry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, mContext)
alm.showNotification(entry)
- mSystemClock.advanceTime((TEST_AUTO_DISMISS_TIME * 3 / 2).toLong())
+ systemClock.advanceTime((TEST_AUTO_DISMISS_TIME * 3 / 2).toLong())
assertThat(alm.isHeadsUpEntry(entry.key)).isFalse()
}
@@ -324,7 +324,7 @@
useAccessibilityTimeout(false)
hum.showNotification(entry)
- mSystemClock.advanceTime((TEST_TOUCH_ACCEPTANCE_TIME / 2 + TEST_AUTO_DISMISS_TIME).toLong())
+ systemClock.advanceTime((TEST_TOUCH_ACCEPTANCE_TIME / 2 + TEST_AUTO_DISMISS_TIME).toLong())
assertThat(hum.isHeadsUpEntry(entry.key)).isTrue()
}
@@ -336,7 +336,7 @@
useAccessibilityTimeout(false)
hum.showNotification(entry)
- mSystemClock.advanceTime(
+ systemClock.advanceTime(
(TEST_TOUCH_ACCEPTANCE_TIME +
(TEST_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2)
.toLong()
@@ -352,7 +352,7 @@
useAccessibilityTimeout(false)
hum.showNotification(entry)
- mSystemClock.advanceTime(
+ systemClock.advanceTime(
(TEST_TOUCH_ACCEPTANCE_TIME +
(TEST_AUTO_DISMISS_TIME + TEST_STICKY_AUTO_DISMISS_TIME) / 2)
.toLong()
@@ -368,7 +368,7 @@
useAccessibilityTimeout(false)
hum.showNotification(entry)
- mSystemClock.advanceTime(
+ systemClock.advanceTime(
(TEST_TOUCH_ACCEPTANCE_TIME + 2 * TEST_A11Y_AUTO_DISMISS_TIME).toLong()
)
@@ -382,7 +382,7 @@
useAccessibilityTimeout(true)
hum.showNotification(entry)
- mSystemClock.advanceTime(
+ systemClock.advanceTime(
(TEST_TOUCH_ACCEPTANCE_TIME +
(TEST_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2)
.toLong()
@@ -398,7 +398,7 @@
useAccessibilityTimeout(true)
hum.showNotification(entry)
- mSystemClock.advanceTime(
+ systemClock.advanceTime(
(TEST_TOUCH_ACCEPTANCE_TIME +
(TEST_STICKY_AUTO_DISMISS_TIME + TEST_A11Y_AUTO_DISMISS_TIME) / 2)
.toLong()
@@ -424,9 +424,7 @@
assertThat(removedImmediately).isFalse()
assertThat(hum.isHeadsUpEntry(entry.key)).isTrue()
- mSystemClock.advanceTime(
- ((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2).toLong()
- )
+ systemClock.advanceTime(((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2).toLong())
assertThat(hum.isHeadsUpEntry(entry.key)).isFalse()
}
@@ -438,9 +436,7 @@
useAccessibilityTimeout(false)
hum.showNotification(entry)
- mSystemClock.advanceTime(
- ((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2).toLong()
- )
+ systemClock.advanceTime(((TEST_MINIMUM_DISPLAY_TIME + TEST_AUTO_DISMISS_TIME) / 2).toLong())
assertThat(hum.isHeadsUpEntry(entry.key)).isTrue()
@@ -633,12 +629,10 @@
hum.onEntryAdded(entryToPin)
assertThat(mUiEventLoggerFake.numLogs()).isEqualTo(2)
- assertThat(
- AvalancheController.ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN.getId(),
- ).isEqualTo(mUiEventLoggerFake.eventId(0))
- assertThat(
- HeadsUpManagerImpl.NotificationPeekEvent.NOTIFICATION_PEEK.id,
- ).isEqualTo(mUiEventLoggerFake.eventId(1))
+ assertThat(AvalancheController.ThrottleEvent.AVALANCHE_THROTTLING_HUN_SHOWN.getId())
+ .isEqualTo(mUiEventLoggerFake.eventId(0))
+ assertThat(HeadsUpManagerImpl.NotificationPeekEvent.NOTIFICATION_PEEK.id)
+ .isEqualTo(mUiEventLoggerFake.eventId(1))
}
@Test
@@ -660,9 +654,8 @@
hum.onEntryAdded(entryToPin)
assertThat(mUiEventLoggerFake.numLogs()).isEqualTo(1)
- assertThat(
- HeadsUpManagerImpl.NotificationPeekEvent.NOTIFICATION_PEEK.id,
- ).isEqualTo(mUiEventLoggerFake.eventId(0))
+ assertThat(HeadsUpManagerImpl.NotificationPeekEvent.NOTIFICATION_PEEK.id)
+ .isEqualTo(mUiEventLoggerFake.eventId(0))
}
@Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.kt
index 96f0201..a5fecb8 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/headsup/HeadsUpManagerImplTest.kt
@@ -42,8 +42,6 @@
import com.android.systemui.util.concurrency.mockExecutorHandler
import com.android.systemui.util.kotlin.JavaAdapter
import com.google.common.truth.Truth.assertThat
-import junit.framework.Assert
-import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
@@ -58,18 +56,18 @@
@RunWithLooper
class HeadsUpManagerImplTest(flags: FlagsParameterization) : HeadsUpManagerImplOldTest(flags) {
- private val mHeadsUpManagerLogger = HeadsUpManagerLogger(logcatLogBuffer())
+ private val headsUpManagerLogger = HeadsUpManagerLogger(logcatLogBuffer())
private val kosmos = testKosmos().useUnconfinedTestDispatcher()
private val testScope = kosmos.testScope
- private val mGroupManager = mock<GroupMembershipManager>()
- private val mBgHandler = mock<Handler>()
+ private val groupManager = mock<GroupMembershipManager>()
+ private val bgHandler = mock<Handler>()
val statusBarStateController = kosmos.sysuiStatusBarStateController
- private val mJavaAdapter: JavaAdapter = JavaAdapter(testScope.backgroundScope)
+ private val javaAdapter: JavaAdapter = JavaAdapter(testScope.backgroundScope)
- private lateinit var mAvalancheController: AvalancheController
+ private lateinit var avalancheController: AvalancheController
private lateinit var underTest: HeadsUpManagerImpl
@Before
@@ -94,31 +92,31 @@
whenever(kosmos.keyguardBypassController.bypassEnabled).thenReturn(false)
kosmos.visualStabilityProvider.isReorderingAllowed = true
- mAvalancheController =
+ avalancheController =
AvalancheController(
kosmos.dumpManager,
kosmos.uiEventLoggerFake,
- mHeadsUpManagerLogger,
- mBgHandler,
+ headsUpManagerLogger,
+ bgHandler,
)
underTest =
HeadsUpManagerImpl(
mContext,
- mHeadsUpManagerLogger,
+ headsUpManagerLogger,
statusBarStateController,
kosmos.keyguardBypassController,
- mGroupManager,
+ groupManager,
kosmos.visualStabilityProvider,
kosmos.configurationController,
- mockExecutorHandler(mExecutor),
- mGlobalSettings,
- mSystemClock,
- mExecutor,
+ mockExecutorHandler(executor),
+ globalSettings,
+ systemClock,
+ executor,
kosmos.accessibilityManagerWrapper,
kosmos.uiEventLoggerFake,
- mJavaAdapter,
+ javaAdapter,
kosmos.shadeInteractor,
- mAvalancheController,
+ avalancheController,
)
}
@@ -127,7 +125,7 @@
val entry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, mContext)
underTest.showNotification(entry)
underTest.snooze()
- Assert.assertTrue(underTest.isSnoozed(entry.sbn.packageName))
+ assertThat(underTest.isSnoozed(entry.sbn.packageName)).isTrue()
}
@Test
@@ -143,8 +141,8 @@
/* releaseImmediately= */ false,
/* reason= */ "swipe out",
)
- Assert.assertTrue(removedImmediately)
- Assert.assertFalse(underTest.isHeadsUpEntry(entry.key))
+ assertThat(removedImmediately).isTrue()
+ assertThat(underTest.isHeadsUpEntry(entry.key)).isFalse()
}
@Test
@@ -154,7 +152,7 @@
underTest.addSwipedOutNotification(entry.key)
// Notification is swiped so it can be immediately removed.
- Assert.assertTrue(underTest.canRemoveImmediately(entry.key))
+ assertThat(underTest.canRemoveImmediately(entry.key)).isTrue()
}
@Ignore("b/141538055")
@@ -167,7 +165,7 @@
underTest.showNotification(laterEntry)
// Notification is "behind" a higher priority notification so we can remove it immediately.
- Assert.assertTrue(underTest.canRemoveImmediately(earlierEntry.key))
+ assertThat(underTest.canRemoveImmediately(earlierEntry.key)).isTrue()
}
@Test
@@ -175,8 +173,8 @@
val entry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, mContext)
underTest.showNotification(entry)
underTest.extendHeadsUp()
- mSystemClock.advanceTime(((TEST_AUTO_DISMISS_TIME + TEST_EXTENSION_TIME) / 2).toLong())
- Assert.assertTrue(underTest.isHeadsUpEntry(entry.key))
+ systemClock.advanceTime(((TEST_AUTO_DISMISS_TIME + TEST_EXTENSION_TIME) / 2).toLong())
+ assertThat(underTest.isHeadsUpEntry(entry.key)).isTrue()
}
@Test
@@ -234,7 +232,7 @@
val entry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, mContext)
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isFalse()
}
@Test
@@ -251,7 +249,7 @@
val headsUpEntry = underTest.getHeadsUpEntry(notifEntry.key)
headsUpEntry!!.mWasUnpinned = false
- Assert.assertTrue(underTest.shouldHeadsUpBecomePinned(notifEntry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(notifEntry)).isTrue()
}
@Test
@@ -268,7 +266,7 @@
val headsUpEntry = underTest.getHeadsUpEntry(notifEntry.key)
headsUpEntry!!.mWasUnpinned = true
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(notifEntry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(notifEntry)).isFalse()
}
@Test
@@ -283,7 +281,7 @@
statusBarStateController.setState(StatusBarState.SHADE)
// THEN
- Assert.assertTrue(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isTrue()
}
@Test
@@ -294,7 +292,7 @@
statusBarStateController.setState(StatusBarState.SHADE_LOCKED)
// THEN
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isFalse()
}
@Test
@@ -305,7 +303,7 @@
statusBarStateController.setState(1207)
// THEN
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isFalse()
}
@Test
@@ -318,7 +316,7 @@
statusBarStateController.setState(StatusBarState.KEYGUARD)
// THEN
- Assert.assertTrue(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isTrue()
}
@Test
@@ -331,7 +329,7 @@
statusBarStateController.setState(StatusBarState.KEYGUARD)
// THEN
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isFalse()
}
@Test
@@ -346,7 +344,7 @@
statusBarStateController.setState(StatusBarState.SHADE)
// THEN
- Assert.assertFalse(underTest.shouldHeadsUpBecomePinned(entry))
+ assertThat(underTest.shouldHeadsUpBecomePinned(entry)).isFalse()
}
companion object {