fragment/src/androidTest/java/androidx/fragment/app/FragmentTransactionTest.java
@Test
    @UiThreadTest
    public void crashOnBackPressed() throws Throwable {
        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Bundle outState = new Bundle();
        FragmentTestActivity activity = mActivityRule.getActivity();
        instrumentation.callActivityOnSaveInstanceState(activity, outState);
        activity.onBackPressed();
    }
/**
     * Test to ensure that when onBackPressed() is received that there is no crash.
     */
Test to ensure that when onBackPressed() is received that there is no crash.
Test to ensure that when onBackPressed () is received that there is no crash .
@Test
    @UiThreadTest
    public void crashOnBackPressed() throws Throwable {
        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Bundle outState = new Bundle();
        FragmentTestActivity activity = mActivityRule.getActivity();
        instrumentation.callActivityOnSaveInstanceState(activity, outState);
        activity.onBackPressed();
    }
@ Test @ UiThreadTest public void crashOnBackPressed ( ) throws Throwable { Instrumentation instrumentation = InstrumentationRegistry . getInstrumentation ( ) ; Bundle outState = new Bundle ( ) ; FragmentTestActivity activity = mActivityRule . getActivity ( ) ; instrumentation . callActivityOnSaveInstanceState ( activity , outState ) ; activity . onBackPressed ( ) ; }
Test to ensure that when onBackPressed() is received that there is no crash.
Test to ensure that when onBackPressed () is received that there is no crash .