summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTara Ojo <taraojo@google.com>2024-04-12 17:24:17 +0000
committerTara Agyemang <taraojo@google.com>2024-04-26 15:07:49 +0000
commit6c0839dd6baccadc3a135be423505a615f41474e (patch)
tree263043933ad8fbf8418b5522590f22fac011da32
parent18f52fe1a241cfa4c83eff0ee1021ed32bc4fe64 (diff)
downloadHealthFitness-master.tar.gz
Use insertRecords response in HealthConnectManagerTestHEADmastermain
We'll make a change in a follow-up CL that means we can no longer rely on the original record being mutated. Bug: 314128192 Test: atest Change-Id: Ia1f2fadc09a7587d5afe6ce431c0b48e0f6ab3b9 Merged-In: Ia1f2fadc09a7587d5afe6ce431c0b48e0f6ab3b9
-rw-r--r--tests/cts/src/android/healthconnect/cts/HealthConnectManagerTest.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/cts/src/android/healthconnect/cts/HealthConnectManagerTest.java b/tests/cts/src/android/healthconnect/cts/HealthConnectManagerTest.java
index 5538d108..82a1fe17 100644
--- a/tests/cts/src/android/healthconnect/cts/HealthConnectManagerTest.java
+++ b/tests/cts/src/android/healthconnect/cts/HealthConnectManagerTest.java
@@ -1632,7 +1632,7 @@ public class HealthConnectManagerTest {
StepsRecord testRecord = TestUtils.getStepsRecord();
try {
- TestUtils.insertRecords(Collections.singletonList(testRecord));
+ testRecord = (StepsRecord) TestUtils.insertRecord(testRecord);
Assert.fail();
} catch (HealthConnectException exception) {
assertThat(exception).isNotNull();
@@ -1788,8 +1788,7 @@ public class HealthConnectManagerTest {
public void testGetRecordTypeInfo_InsertRecords_correctContributingPackages() throws Exception {
// Insert a set of test records for StepRecords, ExerciseSessionRecord, HeartRateRecord,
// BasalMetabolicRateRecord.
- List<Record> testRecords = TestUtils.getTestRecords();
- TestUtils.insertRecords(testRecords);
+ List<Record> testRecords = TestUtils.insertRecords(TestUtils.getTestRecords());
// Populate expected records. This method puts empty lists as contributing packages for all
// records.
@@ -1849,8 +1848,7 @@ public class HealthConnectManagerTest {
throws Exception {
// Insert a sets of test records for StepRecords, ExerciseSessionRecord, HeartRateRecord,
// BasalMetabolicRateRecord.
- List<Record> testRecords = TestUtils.getTestRecords();
- TestUtils.insertRecords(testRecords);
+ List<Record> testRecords = TestUtils.insertRecords(TestUtils.getTestRecords());
// Populate expected records. This method puts empty lists as contributing packages for all
// records.
@@ -1914,11 +1912,9 @@ public class HealthConnectManagerTest {
throws Exception {
// Insert 2 sets of test records for StepRecords, ExerciseSessionRecord, HeartRateRecord,
// BasalMetabolicRateRecord.
- List<Record> testRecords = TestUtils.getTestRecords();
- TestUtils.insertRecords(testRecords);
+ List<Record> testRecords = TestUtils.insertRecords(TestUtils.getTestRecords());
- List<Record> testRecords2 = TestUtils.getTestRecords();
- TestUtils.insertRecords(testRecords2);
+ TestUtils.insertRecords(TestUtils.getTestRecords());
// When recordTypes are modified the appInfo also gets updated and this update happens on
// a background thread. To ensure the test has the latest values for appInfo, add a wait