I open example code BasicRxJavaSample (from this article Room+RxJava) The main thing is there:
@Rule public InstantTaskExecutorRule instantTaskExecutorRule
Replace testImplementation by androidTestImplementation. So the tests on folder androidTest can have access to the library.
dependencies { androidTestImplementation "androidx.arch.core:core-testing:2.1.0" }
If you are not using androidx then use android.arch.core:core-testing:1.1.1
android.arch.core:core-testing:1.1.1