diff --git a/app/src/androidTest/java/WorkerInstrumentationTest.kt b/app/src/androidTest/java/WorkerInstrumentationTest.kt index ca868e1..ded5bdf 100644 --- a/app/src/androidTest/java/WorkerInstrumentationTest.kt +++ b/app/src/androidTest/java/WorkerInstrumentationTest.kt @@ -15,6 +15,7 @@ */ import android.content.Context +import android.os.Build import androidx.test.core.app.ApplicationProvider import androidx.work.ListenableWorker import androidx.work.testing.TestListenableWorkerBuilder @@ -23,6 +24,7 @@ import com.example.bluromatic.KEY_IMAGE_URI import com.example.bluromatic.workers.BlurWorker import com.example.bluromatic.workers.CleanupWorker import com.example.bluromatic.workers.SaveImageToFileWorker +import junit.framework.TestCase import kotlinx.coroutines.runBlocking import org.junit.Assert.assertTrue import org.junit.Before @@ -75,10 +77,17 @@ class WorkerInstrumentationTest { val resultUri = result.outputData.getString(KEY_IMAGE_URI) assertTrue(result is ListenableWorker.Result.Success) assertTrue(result.outputData.keyValueMap.containsKey(KEY_IMAGE_URI)) - assertTrue( - resultUri?.startsWith("content://media/external/images/media/") - ?: false - ) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + TestCase.assertTrue( + resultUri?.startsWith("content://media/external_primary/images/media/") + ?: false + ) + } else { + TestCase.assertTrue( + resultUri?.startsWith("content://media/external/images/media/") + ?: false + ) + } } } }