This is a good clear sample! Have you worked with tests querying for PagedLists?

There is an edge case for testing queries returning a PagedList. A workaround can be applied to explicitly run this type of query on Dispatchers.IO.

See: Run Room @Insert and @Query on Dispatchers.IO

Also, if looking to run a Room database test locally on the JVM, Context can be built with Robolectric as outlined here, Create Context with Robolectric in a local unit test. Once the Context is built, Room’s database can be created as shown in the sample in this Medium post.



Open Sourcer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Hurwitz

Adam Hurwitz

Open Sourcer

More from Medium

What is a Google Android Instant App and why you should use it as a developer?

Google Instant App — Why should you use it?

Android — Intercept POST form data inside of WebView

Android Paging 3 library with Limit and Offset parameters, MVVM, LiveData, Dagger, and Coroutine

fragment stuck cannot move to another fragment in Android Navigation