package Ġcom . google . samples . apps . sun flower Ċ Ċ import Ġandroidx . test . espress o . Id ling Registry Ċ import Ġandroidx . test . espress o . id ling . concurrent . Id ling ThreadPoolExecutor Ċ import Ġandroidx . test . ext . junit . rules . activity Scenario Rule Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . filters . Large Test Ċ import Ġcom . android . example . github . util . Task Executor With Id ling Resource Rule Ċ import Ġcom . example . android . architecture . blueprint s . todo app . util . Data Binding Id ling Resource Ċ import Ġcom . example . android . architecture . blueprint s . todo app . util . monitor Activity Ċ import Ġcom . google . samples . apps . sun flower . page . My G arden Page Ċ import Ġcom . google . samples . apps . sun flower . view models . Plant Detail ViewModel Ċ import Ġkotlinx . coroutines . as Coroutine Dispatcher Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġjava . util .* Ċ import Ġjava . util . concurrent . Linked Blocking Deque Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ @ Large Test Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠG arden Activity Test 2 Ġ{ ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġactivity Scenario Rule Ġ= Ġactivity Scenario Rule < G arden Activity >() ĊĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġtask Executor With Id ling Resource Rule Ġ= ĠTask Executor With Id ling Resource Rule () ĊĊĠĠĠ Ġprivate Ġval Ġdata Binding Id ling Resource Ġ= ĠData Binding Id ling Resource () ĊĊĠĠĠ Ġ// Ġresource Name Ġof ĠId ling ThreadPoolExecutor Ġmust Ġbe Ġunique ĊĠĠĠ Ġprivate Ġvar Ġid ling ThreadPoolExecutor Ġ= ĠId ling ThreadPoolExecutor (" coroutine Ġdispatcher Ġid =${ UUID . randomUUID () }", ĊĠĠĠĠĠĠĠĠĠĠĠĠ 2 , ĊĠĠĠĠĠĠĠĠĠĠĠĠ 1 0 , ĊĠĠĠĠĠĠĠĠĠĠĠĠ 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTimeUnit . MILLISECONDS , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLinked Blocking Deque < Runnable >() ĊĠĠĠ Ġ) Ġ{ ĠThread ( it ) Ġ} ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġid ling Registry Ġ= ĠId ling Registry . getInstance () ĊĠĠĠĠĠĠĠ ĠPl ant Detail ViewModel . override Dispatcher Ġ= Ġid ling ThreadPoolExecutor . as Coroutine Dispatcher () ĊĠĠĠĠĠĠĠ Ġdata Binding Id ling Resource . monitor Activity ( activity Scenario Rule . scenario ) ĊĠĠĠĠĠĠĠ Ġid ling Registry . register ( data Binding Id ling Resource ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠtearDown () Ġ{ ĊĠĠĠĠĠĠĠ ĠId ling Registry . getInstance (). unregister ( data Binding Id ling Resource ) ĊĠĠĠĠĠĠĠ Ġ// ĠShutdown ĠId ling ThreadPoolExecutor Ġin Ġorder Ġto Ġunregister Ġit . ĊĠĠĠĠĠĠĠ ĠPl ant Detail ViewModel . override Dispatcher Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġid ling ThreadPoolExecutor . shutdown () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġg arden Activity Test 2 () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġpage Ġobject Ġimplementation Ġres ides Ġin Ġ` src / shared Test / java `. ĊĠĠĠĠĠĠĠ ĠMy G arden Page ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go Plant List () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. show Plant Detail (" M ango ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo My G arden () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go Back Plant List () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go My G arden () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. assert Pl anted (" M ango ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġg arden Activity Test _ E gg plant () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// Ġpage Ġobject Ġimplementation Ġres ides Ġin Ġ` src / shared Test / java `. ĊĠĠĠĠĠĠĠ ĠMy G arden Page ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go Plant List () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. show Plant Detail (" E gg plant ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. addTo My G arden () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go Back Plant List () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. go My G arden () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. assert Pl anted (" E gg plant ") ĊĠĠĠ Ġ} Ċ } Ċ