Merge "Mock some methods of Context in CoreSettingsObserverTest"

This commit is contained in:
TreeHugger Robot
2023-01-12 01:22:30 +00:00
committed by Android (Google) Code Review

View File

@@ -97,6 +97,8 @@ public class CoreSettingsObserverTest {
mContentResolver = new MockContentResolver(mContext);
mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
when(mContext.getContentResolver()).thenReturn(mContentResolver);
when(mContext.getCacheDir()).thenReturn(originalContext.getCacheDir());
when(mContext.getAttributionSource()).thenReturn(originalContext.getAttributionSource());
when(mContext.getResources()).thenReturn(mResources);
// To prevent NullPointerException at the constructor of ActivityManagerConstants.
when(mResources.getStringArray(anyInt())).thenReturn(new String[0]);