Using library for testing
alextfos opened this issue · comments
Hi,
I configured the library for requests in a common scenario (normal apk compilation) and works fine.
I have a problem trying to use this library for mock requests for testing purposes. The problem is that I can't access to AssetManager from unit tests to get the *.json files.
I tried to mock it:
for (path in mockPaths) {
when<Any>( context.assets.open(path)) .thenReturn(getClass().classLoader.getResourceAsStream(path)) }
But this doesn't works. Do you know how the library can be configured for testing?
Thank you!
The library allows you to implement your own InputStreamProvider
. So depending on what sort of test you are running you can pass different InputStreamProvider
instances.
I don't really understand what your sample code is supposed to do, but I'm sure you can find your answer related to how to locate a file by googling it. That is unrelated to this library.
Ok! Thank you!