Format battery java test code

context:go/pixel-energizer-java-format

Test: manual
Bug: 304439460
Fix: 304439460
Change-Id: I5be0ee41afb3a7018bc7e25cceccc25669924d6c
This commit is contained in:
Jun Lan
2023-11-07 10:16:53 +08:00
parent 2ddabf5785
commit 358a85ecfe
95 changed files with 4477 additions and 3385 deletions

View File

@@ -54,7 +54,8 @@ public class SmartBatteryPreferenceControllerTest {
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
doReturn(mock(DevicePolicyManager.class)).when(mContext)
doReturn(mock(DevicePolicyManager.class))
.when(mContext)
.getSystemService(Context.DEVICE_POLICY_SERVICE);
mFeatureFactory = FakeFeatureFactory.setupForTest();
@@ -99,26 +100,26 @@ public class SmartBatteryPreferenceControllerTest {
public void testGetAvailabilityStatus_smartBatterySupported_returnAvailable() {
doReturn(true).when(mFeatureFactory.powerUsageFeatureProvider).isSmartBatterySupported();
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.AVAILABLE);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.AVAILABLE);
}
@Test
public void testGetAvailabilityStatus_smartBatteryUnSupported_returnDisabled() {
doReturn(false).when(mFeatureFactory.powerUsageFeatureProvider).isSmartBatterySupported();
assertThat(mController.getAvailabilityStatus()).isEqualTo(
BasePreferenceController.UNSUPPORTED_ON_DEVICE);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE);
}
private void putSmartBatteryValue(int value) {
Settings.Global.putInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, value);
Settings.Global.putInt(
mContentResolver, Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, value);
}
private int getSmartBatteryValue() {
return Settings.Global.getInt(mContentResolver,
Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON);
return Settings.Global.getInt(
mContentResolver, Settings.Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, ON);
}
@Test