fragment/src/androidTest/java/androidx/fragment/app/FragmentReorderingTest.java
@Test
    public void addPopBackStack() throws Throwable {
        final CountCallsFragment fragment1 = new CountCallsFragment();
        mInstrumentation.runOnMainSync(new Runnable() {
            @Override
            public void run() {
                mFM.beginTransaction()
                        .add(R.id.fragmentContainer, fragment1)
                        .addToBackStack(null)
                        .setReorderingAllowed(true)
                        .commit();
                mFM.popBackStack();
                mFM.executePendingTransactions();
            }
        });
        FragmentTestUtil.assertChildren(mContainer);

        // Was never instantiated because it was popped before anything could happen
        assertEquals(0, fragment1.onCreateViewCount);
    }
// Popping an added transaction results in no operation
Popping an added transaction results in no operation
Popping an added transaction results in no operation
@Test
    public void addPopBackStack() throws Throwable {
        final CountCallsFragment fragment1 = new CountCallsFragment();
        mInstrumentation.runOnMainSync(new Runnable() {
            @Override
            public void run() {
                mFM.beginTransaction()
                        .add(R.id.fragmentContainer, fragment1)
                        .addToBackStack(null)
                        .setReorderingAllowed(true)
                        .commit();
                mFM.popBackStack();
                mFM.executePendingTransactions();
            }
        });
        FragmentTestUtil.assertChildren(mContainer);
        assertEquals(0, fragment1.onCreateViewCount);
    }
@ Test public void addPopBackStack ( ) throws Throwable { final CountCallsFragment fragment1 = new CountCallsFragment ( ) ; mInstrumentation . runOnMainSync ( new Runnable ( ) { @ Override public void run ( ) { mFM . beginTransaction ( ) . add ( R . id . fragmentContainer , fragment1 ) . addToBackStack ( null ) . setReorderingAllowed ( true ) . commit ( ) ; mFM . popBackStack ( ) ; mFM . executePendingTransactions ( ) ; } } ) ; FragmentTestUtil . assertChildren ( mContainer ) ; assertEquals ( 0 , fragment1 . onCreateViewCount ) ; }
Popping an added transaction results in no operation
Popping an added transaction results in no operation
// Was never instantiated because it was popped before anything could happen