fragment/src/androidTest/java/androidx/fragment/app/FragmentViewTests.java
@Test
    public void replaceZero() throws Throwable {
        FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
        ViewGroup container = (ViewGroup)
                mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();

        final StrictViewFragment fragment = new StrictViewFragment();
        fm.beginTransaction()
                .replace(R.id.fragmentContainer, fragment)
                .addToBackStack(null)
                .commit();
        FragmentTestUtil.executePendingTransactions(mActivityRule);

        FragmentTestUtil.assertChildren(container, fragment);
        assertEquals(View.VISIBLE, fragment.getView().getVisibility());

        fm.popBackStack();
        FragmentTestUtil.executePendingTransactions(mActivityRule);

        FragmentTestUtil.assertChildren(container);
    }
// Replace of empty container. Should act as add and popping should just remove the fragment
Replace of empty container. Should act as add and popping should just remove the fragment
Replace of empty container . Should act as add and popping should just remove the fragment
@Test
    public void replaceZero() throws Throwable {
        FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
        ViewGroup container = (ViewGroup)
                mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
        final FragmentManager fm = mActivityRule.getActivity().getSupportFragmentManager();
        final StrictViewFragment fragment = new StrictViewFragment();
        fm.beginTransaction()
                .replace(R.id.fragmentContainer, fragment)
                .addToBackStack(null)
                .commit();
        FragmentTestUtil.executePendingTransactions(mActivityRule);
        FragmentTestUtil.assertChildren(container, fragment);
        assertEquals(View.VISIBLE, fragment.getView().getVisibility());
        fm.popBackStack();
        FragmentTestUtil.executePendingTransactions(mActivityRule);
        FragmentTestUtil.assertChildren(container);
    }
@ Test public void replaceZero ( ) throws Throwable { FragmentTestUtil . setContentView ( mActivityRule , R . layout . simple_container ) ; ViewGroup container = ( ViewGroup ) mActivityRule . getActivity ( ) . findViewById ( R . id . fragmentContainer ) ; final FragmentManager fm = mActivityRule . getActivity ( ) . getSupportFragmentManager ( ) ; final StrictViewFragment fragment = new StrictViewFragment ( ) ; fm . beginTransaction ( ) . replace ( R . id . fragmentContainer , fragment ) . addToBackStack ( null ) . commit ( ) ; FragmentTestUtil . executePendingTransactions ( mActivityRule ) ; FragmentTestUtil . assertChildren ( container , fragment ) ; assertEquals ( View . VISIBLE , fragment . getView ( ) . getVisibility ( ) ) ; fm . popBackStack ( ) ; FragmentTestUtil . executePendingTransactions ( mActivityRule ) ; FragmentTestUtil . assertChildren ( container ) ; }
Replace of empty container.
Replace of empty container .