Revert "Fix @Test annotation to make Kotlin 2.2 happy."

This reverts commit 28b943f0ce8beed7097ffdf2b887cf0e488403a6.

Reason for revert: b/438184175 - the '=' notation breaks presubmits when used with `assertThrows` as a top-level call, because it is not a void function

Bug: 427745324
Change-Id: I42e0526e47674b6b249a4fbb558fc4c742e34b90
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt
index 0967492..11b3163 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/tiling/DesktopTilingWindowDecorationTest.kt
@@ -60,7 +60,6 @@
 import com.google.common.truth.Truth.assertThat
 import kotlinx.coroutines.CoroutineScope
 import kotlinx.coroutines.MainCoroutineDispatcher
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -712,7 +711,7 @@
 
     // Construction of a tiling divider with null config expects a null pointer here
     // which is a sign a new divider is being created due to dpi changes.
-    @Test
+    @Test(expected = NullPointerException::class)
     fun tilingDividerDestroyed_whenDpiChanges() {
         val task1 = createVisibleTask()
         val additionalTaskHelper: DesktopTilingWindowDecoration.AppResizingHelper = mock()
@@ -737,9 +736,9 @@
 
         tilingDecoration.leftTaskResizingHelper = tiledTaskHelper
         tilingDecoration.desktopTilingDividerWindowManager = desktopTilingDividerWindowManager
-        assertThrows(NullPointerException::class.java) {
-            tilingDecoration.onDensityOrFontScaleChanged()
-        }
+        tilingDecoration.onDensityOrFontScaleChanged()
+
+        verify(desktopTilingDividerWindowManager, times(1)).release()
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
index 885a81f..ae771cc 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/authentication/domain/interactor/AuthenticationInteractorTest.kt
@@ -40,7 +40,6 @@
 import kotlinx.coroutines.test.currentTime
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -99,14 +98,11 @@
             assertFailed(underTest.authenticate(listOf(9, 8, 7, 6, 5, 4)))
         }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun authenticate_withEmptyPin_throwsException() =
-        Assert.assertThrows(IllegalArgumentException::class.java) {
-            testScope.runTest {
-                kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin)
-                
-                underTest.authenticate(listOf())
-            }
+        testScope.runTest {
+            kosmos.fakeAuthenticationRepository.setAuthenticationMethod(Pin)
+            underTest.authenticate(listOf())
         }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt
index d06c329..9803bb9 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/bluetooth/qsdialog/DeviceItemActionInteractorTest.kt
@@ -26,8 +26,6 @@
 import com.google.common.truth.Truth.assertThat
 import kotlinx.coroutines.test.UnconfinedTestDispatcher
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
@@ -160,13 +158,11 @@
         }
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun onActionIconClick_audioSharingDeviceType_throwException() {
         with(kosmos) {
-            assertThrows(IllegalArgumentException::class.java) {
-                testScope.runTest {
-                    actionInteractorImpl.onActionIconClick(audioSharingDeviceItem) {}
-                }
+            testScope.runTest {
+                actionInteractorImpl.onActionIconClick(audioSharingDeviceItem) {}
             }
         }
     }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt
index 3c53967..5128650 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/common/coroutine/CoroutineResultTest.kt
@@ -21,8 +21,6 @@
 import kotlinx.coroutines.CancellationException
 import kotlinx.coroutines.cancel
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -45,11 +43,8 @@
         assertThat(actual.exceptionOrNull()).isInstanceOf(Exception::class.java)
     }
 
-    @Test
-    fun suspendRunCatching_whenCancelled_shouldResumeWithException() =
-        assertThrows(IllegalArgumentException::class.java) {
-            runTest {
-                suspendRunCatching { cancel() }
-            }
-        }
+    @Test(expected = CancellationException::class)
+    fun suspendRunCatching_whenCancelled_shouldResumeWithException() = runTest {
+        suspendRunCatching { cancel() }
+    }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
index baff9a7..8c217d0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/ui/viewmodel/ResizeableItemFrameViewModelTest.kt
@@ -29,7 +29,6 @@
 import kotlinx.coroutines.test.TestScope
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -508,26 +507,19 @@
             assertThat(resizeInfo).isNull()
         }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun testIllegalState_maxHeightLessThanMinHeight() =
-        Assert.assertThrows(IllegalArgumentException::class.java) {
-            testScope.runTest {
-                updateGridLayout(singleSpanGrid.copy(maxHeightPx = 50, minHeightPx = 100))
-            }
+        testScope.runTest {
+            updateGridLayout(singleSpanGrid.copy(maxHeightPx = 50, minHeightPx = 100))
         }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun testIllegalState_currentSpanExceedsTotalSpans() =
-        Assert.assertThrows(IllegalArgumentException::class.java) {
-            testScope.runTest {
-                updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) }
-        }
+        testScope.runTest { updateGridLayout(singleSpanGrid.copy(currentSpan = 3, totalSpans = 2)) }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun testIllegalState_resizeMultipleZeroOrNegative() =
-        Assert.assertThrows(IllegalArgumentException::class.java) {
-            testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) }
-        }
+        testScope.runTest { updateGridLayout(singleSpanGrid.copy(resizeMultiple = 0)) }
 
     @Test
     fun testZeroHeights_cannotResize() =
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/data/repository/FlashlightRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/data/repository/FlashlightRepositoryTest.kt
index 283c3ec..d499929 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/data/repository/FlashlightRepositoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/data/repository/FlashlightRepositoryTest.kt
@@ -33,8 +33,6 @@
 import com.android.systemui.kosmos.runTest
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import java.util.concurrent.Executor
 import kotlin.time.Duration.Companion.seconds
 import org.junit.Test
@@ -271,8 +269,8 @@
             assertThat(state).isEqualTo(FlashlightModel.Unavailable.Temporarily.CameraInUse)
         }
 
-    @Test
-    fun setLevel0_throwsException() = assertThrows(IllegalArgumentException::class.java) {
+    @Test(expected = IllegalArgumentException::class)
+    fun setLevel0_throwsException() =
         kosmos.runTest {
             injectCameraCharacteristics(true, CameraCharacteristics.LENS_FACING_BACK)
 
@@ -286,10 +284,11 @@
             assertThat(state).isEqualTo(disabledAtDefaultLevel)
 
             underTest.setLevel(0)
-        }
-    }
 
-    @Test
+            assertThat(state).isEqualTo(disabledAtDefaultLevel)
+        }
+
+    @Test(expected = IllegalArgumentException::class)
     fun setLevelNegative_throwsException() =
         kosmos.runTest {
             injectCameraCharacteristics(true, CameraCharacteristics.LENS_FACING_BACK)
@@ -303,12 +302,12 @@
 
             assertThat(state).isEqualTo(disabledAtDefaultLevel)
 
-            assertThrows(IllegalArgumentException::class.java) {
-                underTest.setLevel(-1) // exception thrown
-            }
+            underTest.setLevel(-1) // exception thrown
+
+            assertThat(state).isEqualTo(disabledAtDefaultLevel)
         }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun setLevelAboveMax_throwsException() =
         kosmos.runTest {
             injectCameraCharacteristics(true, CameraCharacteristics.LENS_FACING_BACK)
@@ -321,9 +320,9 @@
                 FlashlightModel.Available.Level(false, DEFAULT_DEFAULT_LEVEL, DEFAULT_MAX_LEVEL)
             assertThat(state).isEqualTo(disabledAtDefaultLevel)
 
-            assertThrows(IllegalArgumentException::class.java) {
-                underTest.setLevel(DEFAULT_MAX_LEVEL + 1)
-            }
+            underTest.setLevel(DEFAULT_MAX_LEVEL + 1)
+
+            assertThat(state).isEqualTo(disabledAtDefaultLevel)
         }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/ui/viewmodel/FlashlightSliderViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/ui/viewmodel/FlashlightSliderViewModelTest.kt
index 0644080..be8d1a0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/ui/viewmodel/FlashlightSliderViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/flashlight/ui/viewmodel/FlashlightSliderViewModelTest.kt
@@ -34,7 +34,6 @@
 import com.android.systemui.res.R
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -106,19 +105,18 @@
             assertThat(enabled).isEqualTo(false)
         }
 
-    @Test
-    fun setLevelBelowZero_stateUnchanged() {
-        assertThrows(IllegalArgumentException::class.java) {
-            kosmos.runTest {
-                runCurrent()
+    @Test(expected = IllegalArgumentException::class)
+    fun setLevelBelowZero_stateUnchanged() =
+        kosmos.runTest {
+            runCurrent()
 
-                val originalState = underTest.currentFlashlightLevel!!
+            val originalState = underTest.currentFlashlightLevel!!
 
-                underTest.setFlashlightLevel(-1)
-                runCurrent()
-            }
+            underTest.setFlashlightLevel(-1)
+            runCurrent()
+
+            assertThat(underTest.currentFlashlightLevel).isEqualTo(originalState)
         }
-    }
 
     @Test
     fun setLevelMax_stateMax() =
@@ -150,18 +148,17 @@
             assertThat(underTest.currentFlashlightLevel!!.level).isEqualTo(1)
         }
 
-    @Test
-    fun setLevelAboveMax_stateUnchanged() {
-        assertThrows(IllegalArgumentException::class.java) {
-            kosmos.runTest {
-                runCurrent()
-                val originalState = underTest.currentFlashlightLevel!!
+    @Test(expected = IllegalArgumentException::class)
+    fun setLevelAboveMax_stateUnchanged() =
+        kosmos.runTest {
+            runCurrent()
+            val originalState = underTest.currentFlashlightLevel!!
 
-                underTest.setFlashlightLevel(MAX_LEVEL + 1)
-                runCurrent()
-            }
+            underTest.setFlashlightLevel(MAX_LEVEL + 1)
+            runCurrent()
+
+            assertThat(underTest.currentFlashlightLevel).isEqualTo(originalState)
         }
-    }
 
     @Test
     fun updateInteractor_updatesLevel() =
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceConfigTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceConfigTest.kt
index 6f66cdb..47bf653 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceConfigTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/quickaffordance/KeyguardQuickAffordanceConfigTest.kt
@@ -23,8 +23,6 @@
 import com.android.systemui.res.R
 import com.android.systemui.SysuiTestCase
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -57,7 +55,7 @@
         assertThat(intent).isNull()
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun appStoreIntent_packageNameMisconfigured_throwsIllegalStateException() {
         overrideResource(R.string.config_appStorePackageName, "app.store.package.name")
         overrideResource(
@@ -66,9 +64,7 @@
         )
         val packageName = "com.app.package.name"
 
-        assertThrows(IllegalStateException::class.java) {
-            KeyguardQuickAffordanceConfig.appStoreIntent(context, packageName)
-        }
+        KeyguardQuickAffordanceConfig.appStoreIntent(context, packageName)
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/shared/transition/FakeKeyguardTransitionAnimationCallbackTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/shared/transition/FakeKeyguardTransitionAnimationCallbackTest.kt
index 960c7d8..6e44bc7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/shared/transition/FakeKeyguardTransitionAnimationCallbackTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/shared/transition/FakeKeyguardTransitionAnimationCallbackTest.kt
@@ -24,8 +24,6 @@
 import com.android.systemui.kosmos.useUnconfinedTestDispatcher
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -77,27 +75,23 @@
             assertThat(underTest.activeAnimations).isEmpty()
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun onAnimationEnded_throwsWhenNoSuchAnimation() =
         kosmos.runTest {
             underTest.onAnimationStarted(KeyguardState.LOCKSCREEN, KeyguardState.AOD)
             underTest.onAnimationStarted(KeyguardState.AOD, KeyguardState.ALTERNATE_BOUNCER)
             assertThat(underTest.activeAnimations).hasSize(2)
 
-            assertThrows(IllegalStateException::class.java) {
-                underTest.onAnimationEnded(KeyguardState.AOD, KeyguardState.LOCKSCREEN)
-            }
+            underTest.onAnimationEnded(KeyguardState.AOD, KeyguardState.LOCKSCREEN)
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun onAnimationCanceled_throwsWhenNoSuchAnimation() =
         kosmos.runTest {
             underTest.onAnimationStarted(KeyguardState.LOCKSCREEN, KeyguardState.AOD)
             underTest.onAnimationStarted(KeyguardState.AOD, KeyguardState.ALTERNATE_BOUNCER)
             assertThat(underTest.activeAnimations).hasSize(2)
 
-            assertThrows(IllegalStateException::class.java) {
-                underTest.onAnimationCanceled(KeyguardState.AOD, KeyguardState.LOCKSCREEN)
-            }
+            underTest.onAnimationCanceled(KeyguardState.AOD, KeyguardState.LOCKSCREEN)
         }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/KeyguardTransitionAnimationFlowTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/KeyguardTransitionAnimationFlowTest.kt
index adfff05..0bbdfbb 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/KeyguardTransitionAnimationFlowTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/KeyguardTransitionAnimationFlowTest.kt
@@ -35,7 +35,6 @@
 import com.android.systemui.shade.shadeTestUtil
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertThrows
 import kotlin.time.Duration.Companion.milliseconds
 import org.junit.Before
 import org.junit.Test
@@ -63,25 +62,21 @@
                 .setupWithoutSceneContainer(edge = Edge.create(from = LOCKSCREEN, to = DREAMING))
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun zeroDurationThrowsException() =
         kosmos.runTest {
-            assertThrows(IllegalArgumentException::class.java) {
-                val flow = underTest.sharedFlow(duration = 0.milliseconds, onStep = { it })
-            }
+            val flow = underTest.sharedFlow(duration = 0.milliseconds, onStep = { it })
         }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun startTimePlusDurationGreaterThanTransitionDurationThrowsException() =
         kosmos.runTest {
-            assertThrows(IllegalArgumentException::class.java) {
-                val flow =
-                    underTest.sharedFlow(
-                        startTime = 300.milliseconds,
-                        duration = 800.milliseconds,
-                        onStep = { it },
-                    )
-            }
+            val flow =
+                underTest.sharedFlow(
+                    startTime = 300.milliseconds,
+                    duration = 800.milliseconds,
+                    onStep = { it },
+                )
         }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt
index cbcff58..3978312 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/ExclusiveActivatableTest.kt
@@ -25,7 +25,6 @@
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -91,8 +90,8 @@
             assertThat(underTest.cancellationCount).isEqualTo(1)
         }
 
-    @Test
-    fun activate_whileActive_throws() = assertThrows(IllegalStateException::class.java) {
+    @Test(expected = IllegalStateException::class)
+    fun activate_whileActive_throws() =
         testScope.runTest {
             assertThat(underTest.activationCount).isEqualTo(0)
             assertThat(underTest.cancellationCount).isEqualTo(0)
@@ -105,5 +104,4 @@
             underTest.activateIn(testScope)
             runCurrent()
         }
-    }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/HydratedActivatableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/HydratedActivatableTest.kt
index 68daf45..738ed92 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/HydratedActivatableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/lifecycle/HydratedActivatableTest.kt
@@ -40,7 +40,6 @@
 import kotlinx.coroutines.launch
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert.assertThrows
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -110,8 +109,8 @@
             assertThat(underTest.cancellationCount).isEqualTo(1)
         }
 
-    @Test
-    fun activate_whileActive_throws() = assertThrows(IllegalStateException::class.java) {
+    @Test(expected = IllegalStateException::class)
+    fun activate_whileActive_throws() =
         testScope.runTest {
             assertThat(underTest.activationCount).isEqualTo(0)
             assertThat(underTest.cancellationCount).isEqualTo(0)
@@ -124,7 +123,6 @@
             underTest.activateIn(testScope)
             runCurrent()
         }
-    }
 
     @Test
     fun hydratedStateOf() {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/TableLogBufferTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/TableLogBufferTest.kt
index 7eb87bb..f7b81d0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/TableLogBufferTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/log/table/TableLogBufferTest.kt
@@ -26,8 +26,6 @@
 import com.android.systemui.log.table.TableChange.Companion.MAX_STRING_LENGTH
 import com.android.systemui.util.time.FakeSystemClock
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import java.io.PrintWriter
 import java.io.StringWriter
 import org.junit.Before
@@ -65,17 +63,15 @@
             )
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun maxSizeZero_throwsException() {
-        assertThrows(IllegalArgumentException::class.java) {
-            TableLogBufferImpl(
-                maxSize = 0,
-                "name",
-                systemClock,
-                logcatEchoTracker,
-                localLogcat = localLogcat,
-            )
-        }
+        TableLogBufferImpl(
+            maxSize = 0,
+            "name",
+            systemClock,
+            logcatEchoTracker,
+            localLogcat = localLogcat,
+        )
     }
 
     @Test
@@ -99,7 +95,7 @@
         assertThat(logLines(dumpedString).last()).isEqualTo(FOOTER_PREFIX + NAME)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_str_separatorNotAllowedInPrefix() {
         val next =
             object : TestDiffable() {
@@ -107,12 +103,10 @@
                     row.logChange("columnName", "stringValue")
                 }
             }
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
-        }
+        underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_bool_separatorNotAllowedInPrefix() {
         val next =
             object : TestDiffable() {
@@ -120,13 +114,10 @@
                     row.logChange("columnName", true)
                 }
             }
-
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
-        }
+        underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_int_separatorNotAllowedInPrefix() {
         val next =
             object : TestDiffable() {
@@ -134,12 +125,10 @@
                     row.logChange("columnName", 567)
                 }
             }
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
-        }
+        underTest.logDiffs("some${SEPARATOR}thing", TestDiffable(), next)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_str_separatorNotAllowedInColumnName() {
         val next =
             object : TestDiffable() {
@@ -147,13 +136,10 @@
                     row.logChange("column${SEPARATOR}Name", "stringValue")
                 }
             }
-
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("prefix", TestDiffable(), next)
-        }
+        underTest.logDiffs("prefix", TestDiffable(), next)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_bool_separatorNotAllowedInColumnName() {
         val next =
             object : TestDiffable() {
@@ -161,13 +147,10 @@
                     row.logChange("column${SEPARATOR}Name", true)
                 }
             }
-
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("prefix", TestDiffable(), next)
-        }
+        underTest.logDiffs("prefix", TestDiffable(), next)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun dumpChanges_int_separatorNotAllowedInColumnName() {
         val next =
             object : TestDiffable() {
@@ -175,10 +158,7 @@
                     row.logChange("column${SEPARATOR}Name", 456)
                 }
             }
-
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.logDiffs("prefix", TestDiffable(), next)
-        }
+        underTest.logDiffs("prefix", TestDiffable(), next)
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelperTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelperTest.kt
index 7819887..77807bf 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelperTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelperTest.kt
@@ -34,7 +34,6 @@
 import com.android.systemui.util.mockito.nullable
 import com.android.systemui.util.time.FakeSystemClock
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -71,22 +70,18 @@
         mediaTttCommandLineHelper.start()
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun constructor_senderCommandAlreadyRegistered() {
         // Since creating the chip controller should automatically register the sender command, it
         // should throw when registering it again.
-        assertThrows(IllegalStateException::class.java) {
-            commandRegistry.registerCommand(SENDER_COMMAND) { EmptyCommand() }
-        }
+        commandRegistry.registerCommand(SENDER_COMMAND) { EmptyCommand() }
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun constructor_receiverCommandAlreadyRegistered() {
         // Since creating the chip controller should automatically register the receiver command, it
         // should throw when registering it again.
-        assertThrows(IllegalStateException::class.java) {
-            commandRegistry.registerCommand(RECEIVER_COMMAND) { EmptyCommand() }
-        }
+        commandRegistry.registerCommand(RECEIVER_COMMAND) { EmptyCommand() }
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/external/TileRequestDialogEventLoggerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/external/TileRequestDialogEventLoggerTest.kt
index 9472873..12bd5af 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/external/TileRequestDialogEventLoggerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/external/TileRequestDialogEventLoggerTest.kt
@@ -26,7 +26,6 @@
 import com.android.systemui.InstanceIdSequenceFake
 import com.android.systemui.SysuiTestCase
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -120,16 +119,14 @@
         uiEventLogger[0].match(TileRequestDialogEvent.TILE_REQUEST_DIALOG_TILE_ADDED, instanceId)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun testLogResponseInvalid_throws() {
         val instanceId = instanceIdSequence.newInstanceId()
-        assertThrows(IllegalArgumentException::class.java) {
-            logger.logUserResponse(
+        logger.logUserResponse(
                 -1,
                 PACKAGE_NAME,
                 instanceId
-            )
-        }
+        )
     }
 
     private fun UiEventLoggerFake.FakeUiEvent.match(
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/upgrade/CustomTileAddedRepositoryUpgraderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/upgrade/CustomTileAddedRepositoryUpgraderTest.kt
index 78118df..8704ab0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/upgrade/CustomTileAddedRepositoryUpgraderTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/pipeline/domain/upgrade/CustomTileAddedRepositoryUpgraderTest.kt
@@ -33,7 +33,6 @@
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.delay
 import kotlinx.coroutines.flow.MutableStateFlow
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -56,24 +55,21 @@
             assertThat(customTileAddedRepository.getVersion(userFlow.value)).isEqualTo(1)
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun upgradeSkip_exception() =
         kosmos.runTest {
             customTileAddedUpgradeSet = setOf(Optional.of(Upgrader(version = 3)))
-            assertThrows(IllegalStateException::class.java) {
-                underTest.start(userFlow)
-            }
+
+            underTest.start(userFlow)
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun repeatedVersions_exception() =
         kosmos.runTest {
             customTileAddedUpgradeSet =
                 setOf(Optional.of(Upgrader(version = 2)), Optional.of(Upgrader(version = 2)))
 
-            assertThrows(IllegalStateException::class.java) {
-                underTest.start(userFlow)
-            }
+            underTest.start(userFlow)
         }
 
     @OptIn(ExperimentalCoroutinesApi::class)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/shared/model/QSTileConfigProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/shared/model/QSTileConfigProviderTest.kt
index bdb3379..2b8ebb6 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/shared/model/QSTileConfigProviderTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/base/shared/model/QSTileConfigProviderTest.kt
@@ -23,7 +23,6 @@
 import com.android.systemui.qs.pipeline.shared.TileSpec
 import com.android.systemui.util.mockito.mock
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -41,11 +40,9 @@
         assertThat(underTest.getConfig(VALID_SPEC.spec)).isNotNull()
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun throwsForInvalidSpec() {
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.getConfig(INVALID_SPEC.spec)
-        }
+        underTest.getConfig(INVALID_SPEC.spec)
     }
 
     @Test
@@ -58,13 +55,11 @@
         assertThat(underTest.hasConfig(INVALID_SPEC.spec)).isFalse()
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun validatesSpecUponCreation() {
-        assertThrows(IllegalArgumentException::class.java) {
-            createQSTileConfigProviderImpl(
-                mapOf(VALID_SPEC.spec to QSTileConfigTestBuilder.build { tileSpec = INVALID_SPEC })
-            )
-        }
+        createQSTileConfigProviderImpl(
+            mapOf(VALID_SPEC.spec to QSTileConfigTestBuilder.build { tileSpec = INVALID_SPEC })
+        )
     }
 
     private fun createQSTileConfigProviderImpl(
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt
index 0beedd4..6fef9f1 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/qs/tiles/impl/custom/domain/interactor/CustomTileInteractorTest.kt
@@ -41,7 +41,6 @@
 import kotlinx.coroutines.test.advanceTimeBy
 import kotlinx.coroutines.test.runCurrent
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -122,15 +121,9 @@
             }
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun getTileBeforeInitThrows() =
-        with(kosmos) {
-            testScope.runTest {
-                assertThrows(IllegalStateException::class.java) {
-                    underTest.getTile(TEST_USER_1)
-                }
-            }
-        }
+        with(kosmos) { testScope.runTest { underTest.getTile(TEST_USER_1) } }
 
     @Test
     fun initSuspendsForActiveTileNotRestoredAndNotUpdated() =
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
index 04dcc5f..6517da7 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/data/repository/SceneContainerRepositoryTest.kt
@@ -32,7 +32,6 @@
 import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.flow.flowOf
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -76,22 +75,18 @@
             // TODO(b/356596436): When we have a first overlay, add it here and assert contains.
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun changeScene_noSuchSceneInContainer_throws() {
         kosmos.sceneKeys = listOf(Scenes.QuickSettings, Scenes.Lockscreen)
-        assertThrows(IllegalStateException::class.java) {
-            val underTest = kosmos.sceneContainerRepository
-            underTest.changeScene(Scenes.Shade)
-        }
+        val underTest = kosmos.sceneContainerRepository
+        underTest.changeScene(Scenes.Shade)
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun instantlyTransitionTo_noSuchSceneInContainer_throws() {
         kosmos.sceneKeys = listOf(Scenes.QuickSettings, Scenes.Lockscreen)
-        assertThrows(IllegalStateException::class.java) {
-            val underTest = kosmos.sceneContainerRepository
-            underTest.instantlyTransitionTo(Scenes.Shade)
-        }
+        val underTest = kosmos.sceneContainerRepository
+        underTest.instantlyTransitionTo(Scenes.Shade)
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
index 463f946..8060375 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/interactor/SceneInteractorTest.kt
@@ -55,7 +55,6 @@
 import kotlinx.coroutines.flow.first
 import kotlinx.coroutines.flow.flowOf
 import kotlinx.coroutines.flow.toList
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -153,12 +152,9 @@
             assertThat(currentScene).isEqualTo(Scenes.Gone)
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun changeScene_toGoneWhenStillLocked_throws() =
-        kosmos.runTest {
-            assertThrows(IllegalStateException::class.java) {
-                underTest.changeScene(Scenes.Gone, "reason")
-            } }
+        kosmos.runTest { underTest.changeScene(Scenes.Gone, "reason") }
 
     @Test
     fun changeScene_toGoneWhenTransitionToLockedFromGone() =
@@ -277,13 +273,9 @@
             assertThat(currentScene).isEqualTo(Scenes.Gone)
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun snapToScene_toGoneWhenStillLocked_throws() =
-        kosmos.runTest {
-            assertThrows(IllegalStateException::class.java) {
-                underTest.snapToScene(Scenes.Gone, loggingReason = "reason")
-            }
-        }
+        kosmos.runTest { underTest.snapToScene(Scenes.Gone, loggingReason = "reason") }
 
     @Test
     fun snapToScene_toHomeSceneFamily() =
@@ -710,58 +702,46 @@
             assertThat(isVisible).isFalse()
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun changeScene_toIncorrectShade_crashes() =
         kosmos.runTest {
             enableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.changeScene(Scenes.Shade, "reason")
-            }
+            underTest.changeScene(Scenes.Shade, "reason")
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun changeScene_toIncorrectQuickSettings_crashes() =
         kosmos.runTest {
             enableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.changeScene(Scenes.QuickSettings, "reason")
-            }
+            underTest.changeScene(Scenes.QuickSettings, "reason")
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun snapToScene_toIncorrectShade_crashes() =
         kosmos.runTest {
             enableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.snapToScene(Scenes.Shade, loggingReason = "reason")
-            }
+            underTest.snapToScene(Scenes.Shade, loggingReason = "reason")
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun snapToScene_toIncorrectQuickSettings_crashes() =
         kosmos.runTest {
             enableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.changeScene(Scenes.QuickSettings, "reason")
-            }
+            underTest.changeScene(Scenes.QuickSettings, "reason")
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun showOverlay_incorrectShadeOverlay_crashes() =
         kosmos.runTest {
             disableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.showOverlay(Overlays.NotificationsShade, "reason")
-            }
+            underTest.showOverlay(Overlays.NotificationsShade, "reason")
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun showOverlay_incorrectQuickSettingsOverlay_crashes() =
         kosmos.runTest {
             disableDualShade()
-            assertThrows(IllegalStateException::class.java) {
-                underTest.showOverlay(Overlays.QuickSettingsShade, "reason")
-            }
+            underTest.showOverlay(Overlays.QuickSettingsShade, "reason")
         }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModelTest.kt
index a6cc852..b383eb0 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModelTest.kt
@@ -22,72 +22,63 @@
 import com.android.systemui.common.shared.model.ContentDescription
 import com.android.systemui.common.shared.model.Icon
 import com.android.systemui.res.R
-import org.junit.Assert.assertThrows
 import kotlin.test.Test
 import org.junit.runner.RunWith
 
 @SmallTest
 @RunWith(AndroidJUnit4::class)
 class OngoingActivityChipModelTest : SysuiTestCase() {
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun contentIconOnly_butNullIcon_throws() {
-        assertThrows(IllegalArgumentException::class.java) {
-            OngoingActivityChipModel.Active(
-                icon = null,
-                content = OngoingActivityChipModel.Content.IconOnly,
-                key = "test",
-                colors = ColorsModel.SystemThemed,
-                onClickListenerLegacy = null,
-                clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
-            )
-        }
+        OngoingActivityChipModel.Active(
+            icon = null,
+            content = OngoingActivityChipModel.Content.IconOnly,
+            key = "test",
+            colors = ColorsModel.SystemThemed,
+            onClickListenerLegacy = null,
+            clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
+        )
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun contentCountdown_withClickListenerLegacyNotNull_throws() {
-        assertThrows(IllegalArgumentException::class.java) {
-            OngoingActivityChipModel.Active(
-                content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
-                onClickListenerLegacy = {},
-                icon = null,
-                key = "test",
-                colors = ColorsModel.SystemThemed,
-                clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
-            )
-        }
+        OngoingActivityChipModel.Active(
+            content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
+            onClickListenerLegacy = {},
+            icon = null,
+            key = "test",
+            colors = ColorsModel.SystemThemed,
+            clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
+        )
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun contentCountdown_withClickListenerNotNone_throws() {
-        assertThrows(IllegalArgumentException::class.java) {
-            OngoingActivityChipModel.Active(
-                content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
-                clickBehavior = OngoingActivityChipModel.ClickBehavior.ExpandAction {},
-                onClickListenerLegacy = null,
-                icon = null,
-                key = "test",
-                colors = ColorsModel.SystemThemed,
-            )
-        }
+        OngoingActivityChipModel.Active(
+            content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
+            clickBehavior = OngoingActivityChipModel.ClickBehavior.ExpandAction {},
+            onClickListenerLegacy = null,
+            icon = null,
+            key = "test",
+            colors = ColorsModel.SystemThemed,
+        )
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun contentCountdown_withIconNotNull_throws() {
-        assertThrows(IllegalArgumentException::class.java) {
-            OngoingActivityChipModel.Active(
-                content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
-                icon =
+        OngoingActivityChipModel.Active(
+            content = OngoingActivityChipModel.Content.Countdown(secondsUntilStarted = 2),
+            icon =
                 OngoingActivityChipModel.ChipIcon.SingleColorIcon(
                     Icon.Resource(
                         R.drawable.ic_present_to_all,
                         ContentDescription.Resource(R.string.share_to_app_chip_accessibility_label),
                     )
                 ),
-                clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
-                onClickListenerLegacy = null,
-                key = "test",
-                colors = ColorsModel.SystemThemed,
-            )
-        }
+            clickBehavior = OngoingActivityChipModel.ClickBehavior.None,
+            onClickListenerLegacy = null,
+            key = "test",
+            colors = ColorsModel.SystemThemed,
+        )
     }
 }
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/CommandRegistryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/CommandRegistryTest.kt
index 16c6f02..72ffa0e 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/CommandRegistryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/commandline/CommandRegistryTest.kt
@@ -20,7 +20,6 @@
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
 import com.android.systemui.SysuiTestCase
-import org.junit.Assert.assertThrows
 import java.io.PrintWriter
 import java.io.StringWriter
 import java.util.concurrent.Executor
@@ -58,13 +57,11 @@
         registry = CommandRegistry(context, inLineExecutor)
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun testRegisterCommand_throwsWhenAlreadyRegistered() {
         registry.registerCommand(COMMAND) { FakeCommand() }
         // Should throw when registering the same command twice
-        assertThrows(IllegalStateException::class.java) {
-            registry.registerCommand(COMMAND) { FakeCommand() }
-        }
+        registry.registerCommand(COMMAND) { FakeCommand() }
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/PrivacyDotWindowControllerStoreImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/PrivacyDotWindowControllerStoreImplTest.kt
index 3822582..bc7d47c 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/PrivacyDotWindowControllerStoreImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/data/repository/PrivacyDotWindowControllerStoreImplTest.kt
@@ -28,8 +28,6 @@
 import com.android.systemui.testKosmos
 import kotlinx.coroutines.runBlocking
 import kotlinx.coroutines.test.runTest
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -50,11 +48,9 @@
         kosmos.displayRepository.addDisplay(displayId = DISPLAY_2)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun forDisplay_defaultDisplay_throws() {
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.forDisplay(displayId = Display.DEFAULT_DISPLAY)
-        }
+        underTest.forDisplay(displayId = Display.DEFAULT_DISPLAY)
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt
index edc5333..e8dd20b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilderTest.kt
@@ -38,8 +38,6 @@
 import com.android.systemui.statusbar.notification.stack.PriorityBucket
 import com.android.systemui.util.mockito.any
 import com.android.systemui.util.mockito.mock
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -116,15 +114,13 @@
         )
     }
 
-    @Test
+    @Test(expected = RuntimeException::class)
     fun testMultipleSectionsWithSameControllerNonConsecutive() {
         whenever(sectionHeaderVisibilityProvider.sectionHeadersVisible).thenReturn(true)
-        assertThrows(RuntimeException::class.java) {
-            checkOutput(
-                listOf(notif(0, section0), notif(1, section1), notif(2, section3), notif(3, section1)),
-                tree(),
-            )
-        }
+        checkOutput(
+            listOf(notif(0, section0), notif(1, section1), notif(2, section3), notif(3, section1)),
+            tree(),
+        )
     }
 
     @Test
@@ -253,18 +249,16 @@
         )
     }
 
-    @Test
+    @Test(expected = RuntimeException::class)
     fun testRepeatedSectionsThrow() {
         whenever(sectionHeaderVisibilityProvider.sectionHeadersVisible).thenReturn(true)
-        assertThrows(RuntimeException::class.java) {
-            checkOutput(
-                // GIVEN a malformed list where sections are not contiguous
-                listOf(notif(0, section0), notif(1, section1), notif(2, section0)),
+        checkOutput(
+            // GIVEN a malformed list where sections are not contiguous
+            listOf(notif(0, section0), notif(1, section1), notif(2, section0)),
 
-                // THEN an exception is thrown
-                tree(),
-            )
-        }
+            // THEN an exception is thrown
+            tree(),
+        )
     }
 
     private fun checkOutput(list: List<ListEntry>, desiredTree: NodeSpecImpl) {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifLayoutInflaterFactoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifLayoutInflaterFactoryTest.kt
index c430996..371e1c5 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifLayoutInflaterFactoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotifLayoutInflaterFactoryTest.kt
@@ -31,8 +31,6 @@
 import com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.InflationFlag
 import com.android.systemui.util.mockito.mock
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.Mockito.spy
@@ -107,7 +105,7 @@
         assertThat(createdView).isInstanceOf(Button::class.java)
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun onCreateView_multipleFactory_throwIllegalStateException() {
         // GIVEN we have two factories that replaces TextViews in expanded layouts
         val layoutType = FLAG_CONTENT_VIEW_EXPANDED
@@ -126,9 +124,7 @@
             )
 
         // WHEN we try to inflate a TextView for the expanded layout
-        assertThrows(IllegalStateException::class.java) {
-            inflaterFactory.onCreateView("TextView", mContext, attrs)
-        }
+        inflaterFactory.onCreateView("TextView", mContext, attrs)
     }
 
     private fun createReplacementViewFactory(
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt
index bff71d0..a7735e8 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/domain/interactor/NotificationStackAppearanceInteractorTest.kt
@@ -29,8 +29,6 @@
 import com.android.systemui.statusbar.notification.stack.shared.model.ShadeScrimShape
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -89,23 +87,19 @@
                 .isEqualTo(ShadeScrimRounding(isTopRounded = true, isBottomRounded = true))
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun stackNotificationScrimBounds_withImproperBounds_throwsException() =
         kosmos.runTest {
-            assertThrows(IllegalStateException::class.java) {
-                underTest.setNotificationShadeScrimBounds(ShadeScrimBounds(top = 100f, bottom = 99f))
-            }
+            underTest.setNotificationShadeScrimBounds(ShadeScrimBounds(top = 100f, bottom = 99f))
         }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun setQsPanelShape_withImproperBounds_throwsException() =
         kosmos.runTest {
             val invalidBounds = ShadeScrimBounds(top = 0f, bottom = -10f)
-            assertThrows(IllegalStateException::class.java) {
-                underTest.setQsPanelShapeInWindow(
-                    ShadeScrimShape(bounds = invalidBounds, topRadius = 10, bottomRadius = 10)
-                )
-            }
+            underTest.setQsPanelShapeInWindow(
+                ShadeScrimShape(bounds = invalidBounds, topRadius = 10, bottomRadius = 10)
+            )
         }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowControllerImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowControllerImplTest.kt
index c1f3691..df93f88 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowControllerImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/window/StatusBarWindowControllerImplTest.kt
@@ -29,8 +29,6 @@
 import com.android.systemui.statusbar.policy.mockStatusBarConfigurationController
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.kotlin.any
@@ -122,14 +120,12 @@
         assertThat(fakeWindowManager.addedViews).isEmpty()
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     @DisableFlags(StatusBarConnectedDisplays.FLAG_NAME)
     fun stop_connectedDisplaysFlagDisabled_crashes() {
         val underTest = kosmos.statusBarWindowControllerImpl
 
-        assertThrows(IllegalStateException::class.java) {
-            underTest.stop()
-        }
+        underTest.stop()
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/updates/DeviceFoldStateProviderTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/updates/DeviceFoldStateProviderTest.kt
index 02f5b30..ff0321b 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/updates/DeviceFoldStateProviderTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/unfold/updates/DeviceFoldStateProviderTest.kt
@@ -459,6 +459,17 @@
         assertThat(foldProvider.getNumberOfCallbacks()).isEqualTo(1)
     }
 
+    @Test(expected = AssertionError::class)
+    fun startMethod_whileNotOnMainThread_throwsException() {
+        whenever(mainLooper.isCurrentThread).thenReturn(true)
+        try {
+            foldStateProvider.start()
+            fail("Should have thrown AssertionError: should be called from the main thread.")
+        } catch (e: AssertionError) {
+            assertThat(e.message).contains("backgroundThread")
+        }
+    }
+
     @Test
     fun startClosingEvent_whileNotOnKeyguard_triggersAfterThreshold() {
         setKeyguardVisibility(visible = false)
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/TestableAlertDialogTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/TestableAlertDialogTest.kt
index f8f47ac..4351d28 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/TestableAlertDialogTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/TestableAlertDialogTest.kt
@@ -28,8 +28,6 @@
 import com.android.systemui.util.mockito.any
 import com.android.systemui.util.mockito.mock
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.mockito.Mockito.anyInt
@@ -296,13 +294,11 @@
         inOrder.verify(listener).onClick(dialog, BUTTON_NEUTRAL)
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun clickBadButton() {
         val dialog = TestableAlertDialog(context)
 
-        assertThrows(IllegalArgumentException::class.java) {
-            dialog.clickButton(10000)
-        }
+        dialog.clickButton(10000)
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/concurrency/MockExecutorHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/concurrency/MockExecutorHandlerTest.kt
index 00721d6..7ec420f 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/util/concurrency/MockExecutorHandlerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/util/concurrency/MockExecutorHandlerTest.kt
@@ -19,8 +19,9 @@
 import androidx.test.filters.SmallTest
 import com.android.systemui.SysuiTestCase
 import com.android.systemui.util.time.FakeSystemClock
-import org.junit.Assert
-import org.junit.Assert.*
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertTrue
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -226,15 +227,13 @@
      * Verifies that `Handler.removeMessages`, which doesn't make sense with executor backing,
      * causes an error in the test (rather than failing silently like most mocks).
      */
-    @Test
+    @Test(expected = RuntimeException::class)
     fun testRemoveMessages_fails() {
         val clock = FakeSystemClock()
         val fakeExecutor = FakeExecutor(clock)
         val handler = mockExecutorHandler(fakeExecutor)
 
-        assertThrows(RuntimeException::class.java) {
-            handler.removeMessages(1)
-        }
+        handler.removeMessages(1)
     }
 
     private class RunnableImpl : Runnable {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/composable/ComponentsFactoryTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/composable/ComponentsFactoryTest.kt
index ba0d8a7..e3dc552 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/composable/ComponentsFactoryTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/composable/ComponentsFactoryTest.kt
@@ -23,8 +23,6 @@
 import com.android.systemui.volume.panel.shared.model.VolumePanelComponentKey
 import com.android.systemui.volume.panel.shared.model.mockVolumePanelUiComponentProvider
 import com.google.common.truth.Truth
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -50,14 +48,12 @@
         Truth.assertThat(component).isNotNull()
     }
 
-    @Test
+    @Test(expected = IllegalArgumentException::class)
     fun componentAbsence_throws() {
         kosmos.componentByKey = emptyMap()
         initUnderTest()
 
-        assertThrows(IllegalArgumentException::class.java) {
-            underTest.createComponent(TEST_COMPONENT)
-        }
+        underTest.createComponent(TEST_COMPONENT)
     }
 
     private companion object {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt
index 8750c77..d712afe 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/volume/panel/ui/viewmodel/DefaultComponentsLayoutManagerTest.kt
@@ -25,8 +25,6 @@
 import com.android.systemui.volume.panel.ui.layout.ComponentsLayoutManager
 import com.android.systemui.volume.panel.ui.layout.DefaultComponentsLayoutManager
 import com.google.common.truth.Truth
-import org.junit.Assert
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -76,20 +74,17 @@
             .inOrder()
     }
 
-    @Test
+    @Test(expected = IllegalStateException::class)
     fun bottomBarAbsence_throwsException() {
         val component1State = ComponentState(COMPONENT_1, kosmos.mockVolumePanelUiComponent, false)
         val component2State = ComponentState(COMPONENT_2, kosmos.mockVolumePanelUiComponent, false)
-
-        assertThrows(IllegalStateException::class.java) {
-            underTest.layout(
-                VolumePanelState(orientation = 0, isLargeScreen = false),
-                setOf(
-                    component1State,
-                    component2State,
-                )
+        underTest.layout(
+            VolumePanelState(orientation = 0, isLargeScreen = false),
+            setOf(
+                component1State,
+                component2State,
             )
-        }
+        )
     }
 
     private companion object {