/* Ċ Ġ* ĠCopyright Ġ 2 0 1 8 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġandroidx . fragment . app Ċ Ċ import Ġandroid . os . Build Ċ import Ġandroidx . fragment . app . test . Non Config On Stop Activity Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . filters . Medium Test Ċ import Ġandroidx . test . filters . Sdk Suppress Ċ import Ġandroidx . test utils . re create Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ Medium Test Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠFragment Manager Non Config Test Ġ{ ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġvar Ġactivity Rule Ġ= Ġandroidx . test . rule . Activity Test Rule ( Non Config On Stop Activity :: class . java ) ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠWhen Ġa Ġfragment Ġis Ġadded Ġduring Ġon Stop (), Ġit Ġshouldn 't Ġshow Ġup Ġin Ġnon - config ĊĠĠĠĠ Ġ* Ġstate Ġwhen Ġrestored Ġbefore ĠP , Ġbecause ĠOn Save InstanceState Ġwas Ġalready Ġcalled . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Sdk Suppress ( max Sdk Version Ġ= ĠBuild . VERSION _ CODES . O _ MR 1 ) ĊĠĠĠ Ġfun Ġnon Config Stop () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . re create () ĊĊĠĠĠĠĠĠĠ Ġ// ĠA Ġfragment Ġwas Ġadded Ġin Ġon Stop (), Ġbut Ġwe Ġshouldn 't Ġsee Ġit Ġhere ... ĊĠĠĠĠĠĠĠ ĠassertThat ( activity . support FragmentManager . fragments . isEmpty ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠWhen Ġa Ġfragment Ġis Ġadded Ġduring Ġon Stop (), Ġit Ġshouldn 't Ġshow Ġup Ġin Ġnon - config ĊĠĠĠĠ Ġ* Ġstate Ġwhen Ġrestored Ġafter Ġ(>= ) ĠP , Ġbecause ĠOn Save InstanceState Ġisn 't Ġyet Ġcalled . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Sdk Suppress ( min Sdk Version Ġ= ĠBuild . VERSION _ CODES . P ) ĊĠĠĠ Ġfun Ġnon Config Stop Saving Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= Ġactivity Rule . re create () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( activity . support FragmentManager . fragments . size ). isEqualTo ( 1 ) ĊĠĠĠ Ġ} Ċ } Ċ