Hi! Please help with mocking in Unit Tests... I've a global logger class (I know this isn't ideal, but for now it's convenient) that wraps the Android logger. I'm now running unit tests and it crashes with "Method i in android.util.Log not mocked". So I need to mock this class somehow. Can I do that, given that it's in a global
05/07/2020, 9:52 AM
I think its better to wrap it with your own class and use DI.
And for Unit tests inject an empty implementation.
05/09/2020, 11:41 AM
"For now it's convenient" I really don't want to have to pass the logger around everywhere. I know it's the "correct way" but taking this tradeoff
figured how work around it by creating a logger class in the same package in the test dir, which overrides the original logger. Didn't need to add a mocking library.