Mocking Android resources with Mockito and Kotlin
I bumped into an issue that was a little harder than I expected to solve, so this is the documentation. Requirement: Load a JSON file from the res/raw resource directory. Actually, that wasn’t the problem. The problem was how do you test that functionality? The library I have a basic configuration library that is constructed like this: class Configuration internal constructor(jsonContext: String): Map<String, Any> { internal constructor(stream: InputStream) : this(stream.buf...