I am writing my first Android database backend and I\'m struggling to unit test the creation of my database.
Currently the problem I am encountering is obtaining a va
You can use InstrumentationRegistry methods to get a Context:
InstrumentationRegistry.getTargetContext()
- provides the application Context
of the target application.
InstrumentationRegistry.getContext()
- provides the Context
of this Instrumentation’s package.
For AndroidX use InstrumentationRegistry.getInstrumentation().getTargetContext()
or InstrumentationRegistry.getInstrumentation().getContext()
.