Elye Elye - 1 year ago 409
Android Question

`RenamingDelegatingContext` is deprecated. How do we test SQLite db now?

As per http://stackoverflow.com/a/13556184/3286489, we could use

for aiding the SQLite DB unit test for Android development.

However in beginning API level 24, android doc announced that this is now deprecated. So what is the new approach of testing we could do in replacing

Answer Source

I have found a solution, where we could just use Robolectric's RuntimeEnvironment.application as the Context, and the others would be straight forward as normal Unit test process.

In case if more details is needed, do refer to this, that has complete code of having Android SQLite DB unit tested. https://medium.com/@elye.project/android-sqlite-database-unit-testing-is-easy-a09994701162#.rhdv2qa9o

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download