Make a strong reference to LifecycleOwner in tests
Change-Id: Id3b26ded6c903b67b9880dbfe1a0656a564c8947 Fixes: 71867776 Test: rerun tests
This commit is contained in:
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.LoaderManager;
|
||||
import android.arch.lifecycle.LifecycleOwner;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.TestConfig;
|
||||
@@ -49,7 +50,9 @@ public class SuggestionControllerMixinTest {
|
||||
|
||||
@Mock
|
||||
private SuggestionControllerMixin.SuggestionControllerHost mHost;
|
||||
|
||||
private Context mContext;
|
||||
private LifecycleOwner mLifecycleOwner;
|
||||
private Lifecycle mLifecycle;
|
||||
private SuggestionControllerMixin mMixin;
|
||||
|
||||
@@ -58,7 +61,8 @@ public class SuggestionControllerMixinTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
FakeFeatureFactory.setupForTest();
|
||||
mLifecycle = new Lifecycle(() -> mLifecycle);
|
||||
mLifecycleOwner = () -> mLifecycle;
|
||||
mLifecycle = new Lifecycle(mLifecycleOwner);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
Reference in New Issue
Block a user