Set default locale in the testing environment to avoid flaky test

from the error message, looks like some testing environment cannot get the default locale settings to cause it crash. we will et the default locale before testing to avoid such condition.

Bug: 188947451
Test: make SettingsgRoboTests
Change-Id: I6ec9abba41d72c205426df8710eae5b83a841f46
This commit is contained in:
ykhung
2021-06-01 14:53:47 +08:00
committed by YUKAI HUNG
parent bc55541ed9
commit 7a6bd1e4a4
2 changed files with 4 additions and 1 deletions

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