You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
I've found no example code available from google (or anyone) of unit tests that depend on mocking the Room database and tightly coupled dao objects: SunshineDatabase.getInstance(context).weatherDao();
Note: I'm explicitly not talking about instrumented tests.
I used PowerMock(ito) to mock the canonical RoomDatabase.getInstance() static method at the heart of it all. Is this the best way? Or is it skipped because Dagger2 is the preferred way, and that is deemed to complex for these example apps?
Either way, please add best practice examples of unit testing Room with mocks, whether it be with dependency injection or mocking the static getInstance() method.
Thanks.
The text was updated successfully, but these errors were encountered:
I've found no example code available from google (or anyone) of unit tests that depend on mocking the Room database and tightly coupled dao objects:
SunshineDatabase.getInstance(context).weatherDao();
Note: I'm explicitly not talking about instrumented tests.
I used PowerMock(ito) to mock the canonical RoomDatabase.getInstance() static method at the heart of it all. Is this the best way? Or is it skipped because Dagger2 is the preferred way, and that is deemed to complex for these example apps?
Either way, please add best practice examples of unit testing Room with mocks, whether it be with dependency injection or mocking the static getInstance() method.
Thanks.
The text was updated successfully, but these errors were encountered: