Closed alvindizon closed 2 years ago
All Braze methods on the singleton can use sharedpreferences in order to accomplish the various actions of the SDK. In order to assist with your mocking, the SDK retrieves its application context via applicationContext = context.applicationContext
where context
is the one passed into the getInstance()
method.
Hey @alvindizon ,
I'm closing this issue for now. Please let me know if you continue to have issues and we'll debug further.
What problem are you facing?
Our app is currently using Braze SDK v21.0.0, and the recent updates to the Braze SDK have broken our unit tests. We basically have a wrapper class that stores a reference to a
Braze
object, and it is thru this wrapper that we log custom events, change users, etc.We use MockK for unit tests and in one of our unit tests, we ran into this error:
can't find stub Context(temporary mock)
when testing our class that callsBraze.changeUser
. Looking at the stack trace of the error, it seems to point togetSharedPreferences
:Could you enlighten us or provide advice on how to resolve this?
Workarounds
N/A
Ideal Solution
No response
Other Information
No response