import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private void testBindToLifecycle(LifecycleProvider provider) {
Fragment fragment = (Fragment) provider;
startFragment(fragment);
fragment.onAttach(null);
TestObserver attachObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onCreate(null);
attachObserver.assertNotComplete();
TestObserver createObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onViewCreated(null, null);
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
TestObserver createViewObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onStart();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
createViewObserver.assertNotComplete();
TestObserver startObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onResume();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
createViewObserver.assertNotComplete();
startObserver.assertNotComplete();
TestObserver resumeObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onPause();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
createViewObserver.assertNotComplete();
startObserver.assertNotComplete();
resumeObserver.assertComplete();
TestObserver pauseObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onStop();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
createViewObserver.assertNotComplete();
startObserver.assertComplete();
pauseObserver.assertComplete();
TestObserver stopObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onDestroyView();
attachObserver.assertNotComplete();
createObserver.assertNotComplete();
createViewObserver.assertComplete();
stopObserver.assertComplete();
TestObserver destroyViewObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onDestroy();
attachObserver.assertNotComplete();
createObserver.assertComplete();
destroyViewObserver.assertComplete();
TestObserver destroyObserver = observable.compose(provider.bindToLifecycle()).test();
fragment.onDetach();
attachObserver.assertComplete();
destroyObserver.assertComplete();
}