Merge "Set default locale in the testing environment to avoid flaky test" into sc-dev

This commit is contained in:
YUKAI HUNG
2021-06-01 08:26:24 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 1 deletions

View File

@@ -93,8 +93,9 @@ public final class BatteryChartPreferenceControllerTest {
@Before
public void setUp() {
org.robolectric.shadows.ShadowSettings.set24HourTimeFormat(false);
MockitoAnnotations.initMocks(this);
Locale.setDefault(new Locale("en_US"));
org.robolectric.shadows.ShadowSettings.set24HourTimeFormat(false);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mMetricsFeatureProvider = mFeatureFactory.metricsFeatureProvider;
mContext = spy(RuntimeEnvironment.application);

View File

@@ -60,6 +60,8 @@ public final class ConvertUtilsTest {
mContext = spy(RuntimeEnvironment.application);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mPowerUsageFeatureProvider = mFeatureFactory.powerUsageFeatureProvider;
Locale.setDefault(new Locale("en_US"));
org.robolectric.shadows.ShadowSettings.set24HourTimeFormat(false);
}
@Test