I\'m testing with AS 3.4.1 and Emulator running Android 9.
The following test won\'t run, when I use a Room Dao Function annotated with @Transaction
in
I faced the same issue and the problem was because of the InstantTaskExecutorRule
, if you remove the below block of code the @Transaction
should work fine with the suspend
keyword
@Rule
@JvmField
val instantTaskExecutorRule = InstantTaskExecutorRule()
It seems that this rule blocks the RoomDatabase
from acquiring the transaction thread. In RoomDatabase.kt
execution gets blocked in the below function:
private suspend fun Executor.acquireTransactionThread(controlJob: Job): ContinuationInterceptor
Hope this helps!