Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00039da3 authored by Colin Cross's avatar Colin Cross
Browse files

Fix NullPointerException in ControlsRequestDialogTest

When the @NonNull and @Nullable annotations are fixed to be class
retention it triggered an NullPointerException in ControlsRequestDialogTest:

08-25 00:58:09.852  1000 23910 23932 E TestRunner: java.lang.NullPointerException: eq(...) must not be null
08-25 00:58:09.852  1000 23910 23932 E TestRunner: 	at com.android.systemui.controls.management.ControlsRequestDialogTest.testDialogAddsCorrectControl(ControlsRequestDialogTest.kt:138)

com.android.systemui.util.mockito.eq should probably be replaced with
org.mockito.kotlin.eq, but for now just copy org.mockito.kotlin.eq
by adding "?: obj".

Bug: 294110802
Test: atest SystemUITests
Change-Id: Ia3a06575fdad99c8fe3811d64a5879d3dabe854e
parent 10c09e60
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import org.mockito.stubbing.Stubber
 *
 * Generic T is nullable because implicitly bounded by Any?.
 */
fun <T> eq(obj: T): T = Mockito.eq<T>(obj)
fun <T> eq(obj: T): T = Mockito.eq<T>(obj) ?: obj

/**
 * Returns Mockito.any() as nullable type to avoid java.lang.IllegalStateException when