package Ġcom . stripe . android . payments heet Ċ Ċ import Ġandroidx . activity . result . Activity Result Launcher Ċ import Ġandroidx . arch . core . executor . testing . Instant Task Executor Rule Ċ import Ġandroidx . lifecycle . Saved State Handle Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġcom . stripe . android . ApiKey Fixtures Ċ import Ġcom . stripe . android . Payment Configuration Ċ import Ġcom . stripe . android . core . Logger Ċ import Ġcom . stripe . android . core . injection . Injectable Ċ import Ġcom . stripe . android . core . injection . Injector Ċ import Ġcom . stripe . android . core . injection . Injector Key Ċ import Ġcom . stripe . android . core . injection . Weak Map Injector Registry Ċ import Ġcom . stripe . android . google pay launcher . Google Pay PaymentMethod Launcher Ċ import Ġcom . stripe . android . google pay launcher . Google Pay PaymentMethod Launcher Contract Ċ import Ġcom . stripe . android . google pay launcher . injection . Google Pay PaymentMethod Launcher Factory Ċ import Ġcom . stripe . android . model . PaymentMethod Ċ import Ġcom . stripe . android . model . Stripe Intent Ċ import Ġcom . stripe . android . payments . payment launcher . Stripe Payment Launcher Ass isted Factory Ċ import Ġcom . stripe . android . payments heet . analytics . Event Reporter Ċ import Ġcom . stripe . android . payments heet . forms . Form ViewModel Ċ import Ġcom . stripe . android . payments heet . injection . Form ViewModel Sub component Ċ import Ġcom . stripe . android . payments heet . injection . Payment Sheet ViewModel Sub component Ċ import Ġcom . stripe . android . payments heet . model . Stripe Intent Validator Ċ import Ġcom . stripe . android . payments heet . repositories . Stripe Intent Repository Ċ import Ġcom . stripe . android . payments heet . view models . Base Sheet ViewModel Ċ import Ġcom . stripe . android . ui . core . elements . Layout Spec Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . Flow Preview Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġkotlinx . coroutines . test . Un conf ined Test Dispatcher Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Rule Ċ import Ġorg . mockito . kotlin . any Ċ import Ġorg . mockito . kotlin . mock Ċ import Ġorg . mockito . kotlin . wh enever Ċ import Ġjavax . inject . Provider Ċ Ċ @ Experimental Cor outines Api Ċ internal Ġopen Ġclass ĠPayment Sheet ViewModel Test Injection Ġ{ ĊĠĠĠ Ġ@ get : Rule ĊĠĠĠ Ġval Ġrule Ġ= ĠInstant Task Executor Rule () ĊĊĠĠĠ Ġprivate Ġval Ġtest Dispatcher Ġ= ĠUn conf ined Test Dispatcher () ĊĊĠĠĠ Ġval Ġevent Reporter Ġ= Ġmock < Event Reporter >() ĊĠĠĠ Ġprivate Ġval Ġgoogle Pay PaymentMethod Launcher Factory Ġ= ĊĠĠĠĠĠĠĠ Ġcreate Google Pay PaymentMethod Launcher Factory () ĊĠĠĠ Ġprivate Ġval Ġstripe Payment Launcher Ass isted Factory Ġ= ĊĠĠĠĠĠĠĠ Ġmock < Stripe Payment Launcher Ass isted Factory >() ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġinjector : ĠInject or ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġopen Ġfun Ġafter () Ġ{ ĊĠĠĠĠĠĠĠ ĠWeak Map Injector Registry . clear () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Google Pay PaymentMethod Launcher Factory () Ġ= ĊĠĠĠĠĠĠĠ Ġobject Ġ: ĠGoogle Pay PaymentMethod Launcher Factory Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcreate ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlifecycle Scope : ĠCor outine Scope , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġconfig : ĠGoogle Pay PaymentMethod Launcher . Config , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġready Callback : ĠGoogle Pay PaymentMethod Launcher . Ready Callback , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġactivity Result Launcher : ĠActivity Result Launcher < Google Pay PaymentMethod Launcher Contract . Args >, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġskip Ready Check : ĠBoolean ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ): ĠGoogle Pay PaymentMethod Launcher Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġgoogle Pay PaymentMethod Launcher Ġ= Ġmock < Google Pay PaymentMethod Launcher >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġready Callback . on Ready ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġgoogle Pay PaymentMethod Launcher ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Experimental Cor outines Api ĊĠĠĠ Ġfun Ġcreate ViewModel ( ĊĠĠĠĠĠĠĠ Ġstripe Intent : ĠStripe Intent , ĊĠĠĠĠĠĠĠ Ġcustomer Repository PM s : ĠList < PaymentMethod > Ġ= Ġempty List (), ĊĠĠĠĠĠĠĠ Ġ@ Injector Key Ġinjector Key : ĠString , ĊĠĠĠĠĠĠĠ Ġargs : ĠPayment Sheet Contract . Args Ġ= ĠPayment Sheet Fixtures . ARGS _ CUSTOMER _ WITH _ GOOGLE PAY , ĊĠĠĠ Ġ): ĠPayment Sheet ViewModel Ġ= Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠ ĠPayment Sheet ViewModel ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠApplication Provider . getApplicationContext (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġargs , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevent Reporter , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ{ ĠPayment Configuration ( ApiKey Fixtures . FA KE _ PUBL ISH ABLE _ KEY ) Ġ}, ĊĠĠĠĠĠĠĠĠĠĠĠ ĠStripe Intent Repository . Static ( stripe Intent ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠStripe Intent Validator (), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFake Customer Repository ( customer Repository PM s ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFake Prefs Repository (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresource Repository Ġ= Ġmock (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstripe Payment Launcher Ass isted Factory , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġgoogle Pay PaymentMethod Launcher Factory , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠLogger . noop (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtest Dispatcher , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġinjector Key , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsaved State Handle Ġ= ĠSaved State Handle (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġset ( Base Sheet ViewModel . SAVE _ RESOURCE _ REPOSITORY _ READY , Ġtrue ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Flow Preview ĊĠĠĠ Ġfun Ġregister ViewModel ( ĊĠĠĠĠĠĠĠ Ġ@ Injector Key Ġinjector Key : ĠString , ĊĠĠĠĠĠĠĠ ĠviewModel : ĠPayment Sheet ViewModel , ĊĠĠĠĠĠĠĠ Ġform ViewModel : ĠForm ViewModel Ġ= ĠForm ViewModel ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlayout Ġ= ĠLayout Spec . create (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconfig Ġ= Ġmock (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġresource Repository Ġ= Ġmock (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransform Spec To Element Ġ= Ġmock () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġinjector Ġ= Ġobject Ġ: ĠInject or Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġinject ( inject able : ĠInjectable <* >) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( inject able Ġas ? ĠPayment Sheet ViewModel . Factory )?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Builder Ġ= Ġmock < Payment Sheet ViewModel Sub component . Builder >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Sub component Ġ= Ġmock < Payment Sheet ViewModel Sub component >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Sub Component Builder Provider Ġ= Ġmock < Provider < Payment Sheet ViewModel Sub component . Builder >>() ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . build ()). thenReturn ( mock Sub component ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . saved State Handle ( any ())). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . payment Sheet ViewModel Module ( any ())). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Sub component . viewModel ). thenReturn ( viewModel ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Sub Component Builder Provider . get ()). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinject able . sub Component Builder Provider Ġ= Ġmock Sub Component Builder Provider ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ( inject able Ġas ? ĠForm ViewModel . Factory )?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Builder Ġ= Ġmock < Form ViewModel Sub component . Builder >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Sub component Ġ= Ġmock < Form ViewModel Sub component >() ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmock Sub Component Builder Provider Ġ= Ġmock < Provider < Form ViewModel Sub component . Builder >>() ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . build ()). thenReturn ( mock Sub component ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . form Fragment Arguments ( any ())). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Builder . layout ( any ())). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Sub component . viewModel ). thenReturn ( form ViewModel ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġwhenever ( mock Sub Component Builder Provider . get ()). thenReturn ( mock Builder ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinject able . sub Component Builder Provider Ġ= Ġmock Sub Component Builder Provider ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠWeak Map Injector Registry . register ( injector , Ġinjector Key ) ĊĠĠĠ Ġ} Ċ } Ċ