У меня есть WorkManager, который взаимодействует с Room.
class EchoWorker(context: Context, parameters: WorkerParameters)
: Worker(context, parameters), KoinComponent {
val repository: Repository by inject()
override fun doWork(): Result {
repository.getLastGame(5)
return Result.success(inputData)
}
}
@Test
@Throws(Exception::class)
fun testPeriodicWork() {
// Define input data
val input = workDataOf(KEY_1 to 1, KEY_2 to 2)
// Create request
val request = PeriodicWorkRequestBuilder<EchoWorker>(15, MINUTES)
.setInputData(input)
.build()
val workManager = WorkManager.getInstance()
val testDriver = WorkManagerTestInitHelper.getTestDriver()
// Enqueue and wait for result.
workManager.enqueue(request).result.get()
// Tells the testing framework the period delay is met
testDriver.setPeriodDelayMet(request.id)
// Get WorkInfo and outputData
val workInfo = workManager.getWorkInfoById(request.id).get()
// Assert
assertThat(workInfo.state, `is`(WorkInfo.State.ENQUEUED))
}
когда я запускаю этот простой тест, он дает мне:
Cannot find a version of 'androidx.room:room-runtime' that satisfies
the version constraints:
как решить эту проблему?
(это для StackOverFlow.com :):
Lorem Ipsum Dolor Sit Amet, Concetetur Adipiscing Elit. Nullam venenatis tincidunt ultrices. Integer fringilla placerat dictum. Cras nec condimentum eros. Donec lacinia ante sed tellus rhoncus suscipit.