Remove FragmentUtilsTest class

We directly use FragmentController to start fragment.

Change-Id: Iff78f321165d666f96d84f001ff054257a1aaede
Fixes: 111195449
Test: robotest
This commit is contained in:
tmfang
2018-09-27 18:39:18 +08:00
parent 67793945f0
commit c28c836dcb
9 changed files with 61 additions and 31 deletions

View File

@@ -26,16 +26,17 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.XmlRes;
import androidx.fragment.app.FragmentActivity;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settings.widget.SwitchBar;
import com.android.settingslib.testutils.FragmentTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.androidx.fragment.FragmentController;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(shadows = SettingsShadowResources.SettingsShadowTheme.class)
@@ -46,7 +47,8 @@ public class ToggleFeaturePreferenceFragmentTest {
@Test
public void createFragment_shouldOnlyAddPreferencesOnce() {
mFragment = spy(new ToggleFeaturePreferenceFragmentTestable());
FragmentTestUtils.startFragment(mFragment);
FragmentController.setupFragment(mFragment, FragmentActivity.class, 0 /* containerViewId*/,
null /* bundle */);
// execute exactly once
verify(mFragment).addPreferencesFromResource(R.xml.placeholder_prefs);