Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-126

Unit tests should support global init

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Unknown 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: