package Ġcom . aur um tech ie . pulsar file explorer Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroidx . test . espress o . core . internal . deps . gu ava . collect . Iter ables Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . platform . app . Instrumentation Registry . get Instrumentation Ċ import Ġandroidx . test . runner . lifecycle . Activity Lifecycle Monitor Registry Ċ import Ġandroidx . test . runner . lifecycle . Stage Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Assert . assertTrue Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġjava . io . File Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠOpen Folder Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġopen Folder Using An Intent () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġapp Context Ġ= Ġget Instrumentation (). target Context ĊĠĠĠĠĠĠĠ Ġapp Context . startActivity ( Intent ( app Context , ĠFiles List Activity :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠsetData And Type ( Uri . from File ( File ("/ storage / em ulated / 0 / Notes ")), Ġ" resource / folder ") ĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġcurrent Activity Ġ= ĠgetCurrent Activity () ĊĠĠĠĠĠĠĠ ĠassertTrue ( current Activity Ġis ĠFiles List Activity ) ĊĠĠĠĠĠĠĠ Ġval Ġactive Fragment Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( current Activity Ġas ĠFiles List Activity ). support FragmentManager . find Fragment ById ( R . id . directory Container ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( active Fragment Ġis ĠFiles List Fragment ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"/ storage / em ulated / 0 / Notes ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ( active Fragment Ġas ĠFiles List Fragment ). current Path ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Throws ( Throwable :: class ) ĊĠĠĠ Ġfun ĠgetCurrent Activity (): ĠActivity ? Ġ{ ĊĠĠĠĠĠĠĠ Ġget Instrumentation (). waitFor Idle Sync () ĊĠĠĠĠĠĠĠ Ġval Ġactivity Ġ= ĠarrayOf Null s < Activity >( 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġactivities Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠActivity Lifecycle Monitor Registry . getInstance () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Activities In Stage ( Stage . RE SU MED ) ĊĠĠĠĠĠĠĠ Ġactivity [ 0 ] Ġ= ĠIter ables . get Only Element ( activities ) ĊĠĠĠĠĠĠĠ Ġreturn Ġactivity [ 0 ] ĊĠĠĠ Ġ} Ċ } Ċ