package Ġcom . stripe . android . google pay launcher Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . lifecycle . Lifecycle Ċ import Ġandroidx . test . core . app . Activity Scenario Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġcom . stripe . android . ApiKey Fixtures Ċ import Ġcom . stripe . android . Payment Configuration Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġkotlin . test . Before Test Ċ import Ġkotlin . test . Test Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠGoogle Pay Launcher Activity Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġcontext Ġ= ĠApplication Provider . getApplicationContext < Context >() ĊĠĠĠ Ġprivate Ġval Ġcontract Ġ= ĠGoogle Pay Launcher Contract () ĊĊĠĠĠ Ġ@ Before Test ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ ĠPayment Configuration . init ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠApplication Provider . getApplicationContext (), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠApi Key Fixtures . FA KE _ PUBL ISH ABLE _ KEY ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` start Ġwithout Ġargs Ġshould Ġfinish Ġwith ĠError Ġresult `() Ġ{ ĊĠĠĠĠĠĠĠ ĠActivity Scenario . launch ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠGoogle Pay Launcher Activity :: class . java , ĠBundle . EMPTY ĊĠĠĠĠĠĠĠ Ġ). use Ġ{ Ġactivity Scenario Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( activity Scenario . state ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( Lifecycle . State . DESTROY ED ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġparse Result ( activity Scenario ) Ġas ĠGoogle Pay Launcher . Result . Failed ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( result . error . message ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Google Pay Launcher Activity Ġwas Ġstarted Ġwithout Ġarguments ." ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġparse Result ( ĊĠĠĠĠĠĠĠ Ġactivity Scenario : ĠActivity Scenario < *> ĊĠĠĠ Ġ): ĠGoogle Pay Launcher . Result Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġcontract . parse Result ( 0 , Ġactivity Scenario . result . result Data ) ĊĠĠĠ Ġ} Ċ } Ċ