diff --git a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java index 44039910850..f7beaf762a4 100644 --- a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java @@ -22,6 +22,7 @@ import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; +import android.content.res.Configuration; import android.os.UserHandle; import android.os.UserManager; import android.support.v7.preference.Preference; @@ -46,6 +47,7 @@ import org.robolectric.annotation.Config; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; @@ -179,6 +181,9 @@ public class RecentAppsPreferenceControllerTest { .thenReturn(new ResolveInfo()); when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong())) .thenReturn(stats); + final Configuration configuration = new Configuration(); + configuration.locale = Locale.US; + when(mMockContext.getResources().getConfiguration()).thenReturn(configuration); when(mMockContext.getString(eq(R.string.battery_history_minutes_no_seconds), anyInt())) .thenReturn(mContext.getString(R.string.battery_history_minutes_no_seconds, 45)); @@ -245,15 +250,17 @@ public class RecentAppsPreferenceControllerTest { .thenReturn(new ResolveInfo()); when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong())) .thenReturn(stats); - when(mMockContext.getString(eq(R.string.battery_history_minutes_no_seconds), anyInt())) - .thenReturn(mContext.getString(R.string.battery_history_minutes_no_seconds, 35)); + when(mMockContext.getResources().getText(eq(R.string.recent_app_summary))) .thenReturn(mContext.getResources().getText(R.string.recent_app_summary)); + final Configuration configuration = new Configuration(); + configuration.locale = Locale.US; + when(mMockContext.getResources().getConfiguration()).thenReturn(configuration); mController = new RecentAppsPreferenceController(mMockContext, mAppState, null); mController.displayPreference(mScreen); - verify(mCategory).addPreference(argThat(summaryMatches("35m ago"))); + verify(mCategory).addPreference(argThat(summaryMatches("0m ago"))); } private static ArgumentMatcher summaryMatches(String expected) {