Merge "Fix the NPE in LockedUserStateTest since mocks gets cleared before the test finishes execution." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
f31d9b1ab7
@@ -22,7 +22,10 @@ import android.os.Process
|
||||
import android.os.UserManager
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import com.android.launcher3.util.Executors.MAIN_EXECUTOR
|
||||
import com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -45,6 +48,12 @@ class LockedUserStateTest {
|
||||
whenever(context.getSystemService(UserManager::class.java)).thenReturn(userManager)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
UI_HELPER_EXECUTOR.submit {}.get()
|
||||
MAIN_EXECUTOR.submit {}.get()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun runOnUserUnlocked_runs_action_immediately_if_already_unlocked() {
|
||||
whenever(userManager.isUserUnlocked(Process.myUserHandle())).thenReturn(true)
|
||||
|
||||
Reference in New Issue
Block a user