@@ -33,7 +33,8 @@ class DatabaseMigrationTest {
3333 @get:Rule
3434 val testHelper = MigrationTestHelper (
3535 InstrumentationRegistry .getInstrumentation(),
36- AppDatabase ::class .java.canonicalName, FrameworkSQLiteOpenHelperFactory ()
36+ AppDatabase ::class .java.canonicalName,
37+ FrameworkSQLiteOpenHelperFactory ()
3738 )
3839
3940 @Test
@@ -42,7 +43,8 @@ class DatabaseMigrationTest {
4243
4344 databaseInV2.run {
4445 insert(
45- " streams" , SQLiteDatabase .CONFLICT_FAIL ,
46+ " streams" ,
47+ SQLiteDatabase .CONFLICT_FAIL ,
4648 ContentValues ().apply {
4749 put(" service_id" , DEFAULT_SERVICE_ID )
4850 put(" url" , DEFAULT_URL )
@@ -54,14 +56,16 @@ class DatabaseMigrationTest {
5456 }
5557 )
5658 insert(
57- " streams" , SQLiteDatabase .CONFLICT_FAIL ,
59+ " streams" ,
60+ SQLiteDatabase .CONFLICT_FAIL ,
5861 ContentValues ().apply {
5962 put(" service_id" , DEFAULT_SECOND_SERVICE_ID )
6063 put(" url" , DEFAULT_SECOND_URL )
6164 }
6265 )
6366 insert(
64- " streams" , SQLiteDatabase .CONFLICT_FAIL ,
67+ " streams" ,
68+ SQLiteDatabase .CONFLICT_FAIL ,
6569 ContentValues ().apply {
6670 put(" service_id" , DEFAULT_SERVICE_ID )
6771 }
@@ -70,18 +74,31 @@ class DatabaseMigrationTest {
7074 }
7175
7276 testHelper.runMigrationsAndValidate(
73- AppDatabase .DATABASE_NAME , Migrations .DB_VER_3 ,
74- true , Migrations .MIGRATION_2_3
77+ AppDatabase .DATABASE_NAME ,
78+ Migrations .DB_VER_3 ,
79+ true ,
80+ Migrations .MIGRATION_2_3
7581 )
7682
7783 testHelper.runMigrationsAndValidate(
78- AppDatabase .DATABASE_NAME , Migrations .DB_VER_4 ,
79- true , Migrations .MIGRATION_3_4
84+ AppDatabase .DATABASE_NAME ,
85+ Migrations .DB_VER_4 ,
86+ true ,
87+ Migrations .MIGRATION_3_4
8088 )
8189
8290 testHelper.runMigrationsAndValidate(
83- AppDatabase .DATABASE_NAME , Migrations .DB_VER_5 ,
84- true , Migrations .MIGRATION_4_5
91+ AppDatabase .DATABASE_NAME ,
92+ Migrations .DB_VER_5 ,
93+ true ,
94+ Migrations .MIGRATION_4_5
95+ )
96+
97+ testHelper.runMigrationsAndValidate(
98+ AppDatabase .DATABASE_NAME ,
99+ Migrations .DB_VER_6 ,
100+ true ,
101+ Migrations .MIGRATION_5_6
85102 )
86103
87104 val migratedDatabaseV3 = getMigratedDatabase()
@@ -121,7 +138,8 @@ class DatabaseMigrationTest {
121138 private fun getMigratedDatabase (): AppDatabase {
122139 val database: AppDatabase = Room .databaseBuilder(
123140 ApplicationProvider .getApplicationContext(),
124- AppDatabase ::class .java, AppDatabase .DATABASE_NAME
141+ AppDatabase ::class .java,
142+ AppDatabase .DATABASE_NAME
125143 )
126144 .build()
127145 testHelper.closeWhenFinished(database)
0 commit comments