-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
Fallout from #3457
Testing this is non-trivial since the Context is now saved in a system-wide Singleton that remains between unit tests.
We need to refactor to allow the following:
- Add tests for Realm.init() not called
- Don't require all unit tests to specifically require setting this.
A solution I think will work is:
1) Introduce a new RealmUnitTestRunner that extends AndroidJUnit4 runner. It will be responsible for calling Realm.init(InstrumentationTarget.getTargetContext())
2) Add a protected Realm.resetInit() method that allows specific unit tests to reset the state if needed.