Fix whenNoInstaller_notDisplayed

Which is forgot to update in Icd5559bce06c059844269d70926b3c0b39589edb

Bug: 355270127
Flag: EXEMPT test only
Test: atest AppInstallerInfoPreferenceTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:512141619d041cc01e38f3c9b07a84b83a6a1354)
Merged-In: If21215b81008c03a6b6ad2a77a90073a6d708390
Change-Id: If21215b81008c03a6b6ad2a77a90073a6d708390
This commit is contained in:
Chaohui Wang
2024-07-18 11:39:13 +08:00
parent cc7e4e5821
commit a233ca783a

View File

@@ -68,7 +68,6 @@ class AppInstallerInfoPreferenceTest {
@Before @Before
fun setUp() { fun setUp() {
mockSession = mockitoSession() mockSession = mockitoSession()
.initMocks(this)
.mockStatic(AppStoreUtil::class.java) .mockStatic(AppStoreUtil::class.java)
.mockStatic(Utils::class.java) .mockStatic(Utils::class.java)
.mockStatic(AppUtils::class.java) .mockStatic(AppUtils::class.java)
@@ -77,8 +76,7 @@ class AppInstallerInfoPreferenceTest {
whenever(AppStoreUtil.getInstallerPackageName(any(), eq(PACKAGE_NAME))) whenever(AppStoreUtil.getInstallerPackageName(any(), eq(PACKAGE_NAME)))
.thenReturn(INSTALLER_PACKAGE_NAME) .thenReturn(INSTALLER_PACKAGE_NAME)
whenever(AppStoreUtil.getInstallerPackageNameAndInstallSourceInfo(any(), eq(PACKAGE_NAME))) whenever(AppStoreUtil.getInstallerPackageNameAndInstallSourceInfo(any(), eq(PACKAGE_NAME)))
.thenReturn( .thenReturn(Pair(INSTALLER_PACKAGE_NAME, INSTALL_SOURCE_INFO))
Pair<String, InstallSourceInfo>(INSTALLER_PACKAGE_NAME, INSTALL_SOURCE_INFO))
whenever(AppStoreUtil.getAppStoreLink(context, INSTALLER_PACKAGE_NAME, PACKAGE_NAME)) whenever(AppStoreUtil.getAppStoreLink(context, INSTALLER_PACKAGE_NAME, PACKAGE_NAME))
.thenReturn(STORE_LINK) .thenReturn(STORE_LINK)
whenever(AppStoreUtil.isInitiatedFromDifferentPackage(eq(INSTALL_SOURCE_INFO))) whenever(AppStoreUtil.isInitiatedFromDifferentPackage(eq(INSTALL_SOURCE_INFO)))
@@ -97,7 +95,8 @@ class AppInstallerInfoPreferenceTest {
@Test @Test
fun whenNoInstaller_notDisplayed() { fun whenNoInstaller_notDisplayed() {
whenever(AppStoreUtil.getInstallerPackageName(any(), eq(PACKAGE_NAME))).thenReturn(null) whenever(AppStoreUtil.getInstallerPackageNameAndInstallSourceInfo(any(), eq(PACKAGE_NAME)))
.thenReturn(Pair(null, INSTALL_SOURCE_INFO))
setContent() setContent()