package Ġcom . we alth front . mage ll an . lifecycle Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroidx . lifecycle . Lifecycle Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . core . app . launch Activity Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . we alth front . mage ll an . core . Step Ċ import Ġcom . we alth front . mage ll an . internal . test . Att aching Activity Ċ import Ġcom . we alth front . mage ll an . internal . test . Dummy Step Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mockito Annotations . init Mocks Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ public Ġclass ĠActivity Lifecycle Adapter Test Ġ{ ĊĊĠ Ġprivate Ġlateinit Ġvar Ġstep : ĠStep < *> ĊĊĠ Ġprivate Ġlateinit Ġvar Ġactivity Scenario 1 : ĠActivity Scenario < Att aching Activity > ĊĠ Ġprivate Ġlateinit Ġvar Ġactivity Scenario 2 : ĠActivity Scenario < Att aching Activity > ĊĊĠ Ġ@ Before ĊĠ Ġpublic Ġfun ĠsetUp () Ġ{ ĊĠĠĠ Ġinit Mocks ( this ) ĊĠĠĠ Ġstep Ġ= ĠDummy Step () ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġpublic Ġfun ĠtearDown () Ġ{ ĊĠĠĠ Ġactivity Scenario 1 . close () ĊĠĠĠ Ġactivity Scenario 2 . close () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġpublic Ġfun Ġoverlapping Activities _ does Not Crash () Ġ{ ĊĠĠĠ Ġvar Ġrule 2 Activity : ĠActivity ? Ġ= Ġnull ĊĠĠĠ ĠAtt aching Activity . step Ġ= Ġstep ĊĠĠĠ Ġactivity Scenario 1 Ġ= Ġlaunch Activity () ĊĠĠĠ Ġactivity Scenario 2 Ġ= Ġlaunch Activity () ĊĠĠĠ Ġactivity Scenario 2 . on Activity Ġ{ Ġactivity Ġ-> ĊĠĠĠĠĠ Ġrule 2 Activity Ġ= Ġactivity ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġactivity Scenario 1 . moveTo State ( Lifecycle . State . RE SU MED ) ĊĠĠĠ Ġactivity Scenario 1 . moveTo State ( Lifecycle . State . STARTED ) ĊĠĠĠ Ġactivity Scenario 2 . moveTo State ( Lifecycle . State . RE SU MED ) ĊĠĠĠ ĠassertThat ( step . currentState ). isEqualTo ( Lifecycle State . Res umed ( rule 2 Activity !! )) ĊĠ Ġ} Ċ } Ċ