package Ġcom . d roid feed . view model Ċ Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġcom . d roid feed . ui . module . about . About ViewModel Ċ import Ġcom . d roid feed . ui . module . about . analytics . About Screen Logger Ċ import Ġcom . d roid feed . util . Intent Provider Ċ import Ġcom . d roid feed . util . event . Event Observer Ċ import Ġcom . d roid feed . util . get Or Await Value Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . impl . annotations . Mock K Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . un mock k All Ċ import Ġio . mock k . verify Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . JUnit 4 Ċ Ċ @ RunWith ( JUnit 4 :: class ) Ċ class ĠAbout ViewModel Test Ġ{ ĊĊĠĠĠ Ġ@ get : Rule Ġvar Ġinstant Task Executor Rule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġ@ Mock K Ġlateinit Ġvar Ġlogger : ĠAbout Screen Logger ĊĊĠĠĠ Ġlateinit Ġvar Ġsut : ĠAbout ViewModel ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this , Ġrelax ed Ġ= Ġtrue ) ĊĊĠĠĠĠĠĠĠ Ġsut Ġ= ĠAbout ViewModel ( logger ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun Ġclean Up () Ġ{ ĊĠĠĠĠĠĠĠ Ġun mock k All () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen App Rate Clicked _ then Start Rate Intent () Ġ{ ĊĠĠĠĠĠĠĠ Ġsut . rate App () ĊĊĠĠĠĠĠĠĠ Ġassert ( sut . start Intent . get Or Await Value (). peek Content () Ġ== ĠIntent Provider . TYPE . RATE _ APP ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Share App Clicked _ then Start Share App Intent () Ġ{ ĊĠĠĠĠĠĠĠ Ġsut . share App () ĊĊĠĠĠĠĠĠĠ Ġassert ( sut . start Intent . get Or Await Value (). peek Content () Ġ== ĠIntent Provider . TYPE . SHARE _ APP ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Contact Clicked _ then Start Contact Intent () Ġ{ ĊĠĠĠĠĠĠĠ Ġsut . contact Email () ĊĊĠĠĠĠĠĠĠ Ġassert ( sut . start Intent . get Or Await Value (). peek Content () Ġ== ĠIntent Provider . TYPE . CONTACT _ EMAIL ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Open License s Clicked _ then Fire Open License s Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġobserver Ġ= Ġmock k < Event Observer < Unit >>( relax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġsut . open License s . observe Fore ver ( observer ) ĊĊĠĠĠĠĠĠĠ Ġsut . open License s () ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ Ġobserver . on Changed ( any ()) Ġ} ĊĠĠĠ Ġ} Ċ Ċ }