Skip to content

Commit e464ce9

Browse files
committed
Update migration9to10 test
1 parent 61d617d commit e464ce9

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

engine/src/androidTest/java/com/google/android/fhir/db/impl/ResourceDatabaseMigrationTest.kt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,33 @@ class ResourceDatabaseMigrationTest {
418418
assertThat(retrievedTask).isEqualTo(bedNetTask)
419419
}
420420

421-
@Test fun migrate9To10_should_execute_with_no_exception(): Unit = runBlocking { TODO() }
421+
@Test fun migrate9To10_should_execute_with_no_exception(): Unit = runBlocking {
422+
val patientId = "patient-001"
423+
val patientResourceUuid = "e2c79e28-ed4d-4029-a12c-108d1eb5bedb"
424+
val patient: String = Patient().apply {
425+
id = patientId
426+
}.let { iParser.encodeResourceToString(it) }
427+
428+
val taskId = "bed-net-001"
429+
val taskResourceUuid = "8593abf6-b8dd-44d7-a35f-1c8843bc2c45"
430+
val bedNetTask =
431+
Task()
432+
.apply {
433+
id = taskId
434+
status = Task.TaskStatus.READY
435+
`for` = Reference(patient)
436+
}
437+
.let { iParser.encodeResourceToString(it) }
438+
439+
helper.createDatabase(DB_NAME, 9).apply {
440+
execSQL("INSERT INTO ResourceEntity (resourceUuid, resourceType, resourceId, serializedResource) VALUES ('$patientResourceUuid', 'Patient', '$patientId', '$patient');")
441+
execSQL("INSERT INTO ResourceEntity (resourceUuid, resourceType, resourceId, serializedResource) VALUES ('$taskResourceUuid', 'Task', '$taskId', '$bedNetTask');")
442+
443+
execSQL("INSERT INTO ReferenceIndexEntity (resourceUuid, resourceType, index_name, index_path, index_value) VALUES ('$taskResourceUuid', 'Task', 'subject', 'Task.for', 'Patient/$patientId');")
444+
}
445+
446+
TODO("Finish test")
447+
}
422448

423449
companion object {
424450
const val DB_NAME = "migration_tests.db"

0 commit comments

Comments
 (0)