Add data validator to verify and log abnormal queried history data

Bug: 177406865
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I331922cf0b0e946066a72eb0bfcf9885dde9a7ce
This commit is contained in:
ykhung
2021-04-21 01:09:15 +08:00
committed by YUKAI HUNG
parent e8063609eb
commit 70bef1049f
6 changed files with 128 additions and 7 deletions

View File

@@ -187,6 +187,16 @@ public final class BatteryHistEntryTest {
.isFalse();
}
@Test
public void testIsSystemEntry_returnExpectedResult() {
assertThat(createEntry(ConvertUtils.CONSUMER_TYPE_SYSTEM_BATTERY).isSystemEntry())
.isTrue();
assertThat(createEntry(ConvertUtils.CONSUMER_TYPE_USER_BATTERY).isSystemEntry())
.isFalse();
assertThat(createEntry(ConvertUtils.CONSUMER_TYPE_UID_BATTERY).isSystemEntry())
.isFalse();
}
private static BatteryHistEntry createEntry(int consumerType) {
return new BatteryHistEntry(getContentValuesWithType(consumerType));
}