Feature Request P4
Status Update
Comments
yb...@google.com <yb...@google.com> #2
We need something for testing here where we can reset the state to get the new Application instance.
je...@google.com <je...@google.com>
[Deleted User] <[Deleted User]> #3
Any plans to fix this? I'm stuck using java 8 when running tests because of this. Would like to remove this blocking point. Thanks!
Description
Version used: 2.0.0
Devices/Android versions reproduced on: Robolectric 4.3
I initially filed this with Robolectric, but it looks like the root cause is in the ProcessLifecycleOwner class.
This class is a singleton, and its state isn't reset across tests. The consequence is that an app which queries ProcessLifecycleOwner's lifecycle state may not have the expected value when multiple tests are run sequentially.
Sample project here:
A specific example (detailed in the sample project), is that if at the end of test1 the ProcessLifecycleOwner's lifecycle state is RESUMED, it will also be RESUMED at the beginning of test2, which is unexpected (we'd expect the state to be CREATED at the beginning of the test, before any activity is launched).
Note: not sure if this is related:
Note: robolectric issue: