package Ġat . fl or ians ch uster . lo co Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . core . os . bundle Of Ċ import Ġandroidx . fragment . app . Fragment Ċ import Ġandroidx . fragment . app . testing . Fragment Scenario Ċ import Ġandroidx . fragment . app . testing . launch Fragment In Container Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . core . app . launch Activity Ċ import Ġkotlinx . coroutines . delay Ċ import Ġkotlinx . coroutines . flow . flow Ċ Ċ internal Ġval ĠIn defin ite Test Flow Ġ= Ġflow Ġ{ ĊĠĠĠ Ġwhile Ġ( true ) Ġ{ ĊĠĠĠĠĠĠĠ Ġdelay ( 1 0 0 ) ĊĠĠĠĠĠĠĠ Ġemit ( Unit ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ internal Ġenum Ġclass ĠTest Type Ġ{ ĠCreate Destroy , ĠStart Stop , ĠResume Pause Ġ} Ċ Ċ internal Ġconst Ġval ĠTest Type Key : ĠString Ġ= Ġ" Test Type " Ċ Ċ internal Ġinline Ġfun Ġ< re ified ĠA Ġ: ĠActivity > Ġlaunch Activity With ( test Type : ĠTest Type ): ĠActivity Scenario < A > Ġ{ ĊĠĠĠ Ġval Ġintent Ġ= ĠIntent ( Application Provider . getApplicationContext (), ĠA :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġput Extra ( Test Type Key , Ġtest Type . name ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠActivity Scenario . launch ( intent ) Ċ } Ċ Ċ internal Ġfun ĠActivity . require Test Type In Intent (): ĠTest Type Ġ{ ĊĠĠĠ Ġreturn Ġenum ValueOf ( require NotNull ( intent . extras ?. getString ( Test Type Key ))) Ċ } Ċ Ċ internal Ġinline Ġfun Ġ< re ified ĠF Ġ: ĠFragment > Ġlaunch Fragment With ( test Type : ĠTest Type ): ĠFragment Scenario < F > Ġ{ ĊĠĠĠ Ġreturn Ġlaunch Fragment In Container < F >( fragment Args Ġ= Ġbundle Of ( Test Type Key Ġto Ġtest Type . name )) Ċ } Ċ Ċ internal Ġfun ĠFragment . require Test Type In Bundle (): ĠTest Type Ġ{ ĊĠĠĠ Ġreturn Ġenum ValueOf ( require NotNull ( require Arguments (). getString ( Test Type Key ))) Ċ }