package Ġcom . fs ck . k 9 . activity . compose Ċ Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġcom . fs ck . k 9 . Account Ċ import Ġcom . fs ck . k 9 . K 9 Ro bo lectric Test Ċ import Ġcom . fs ck . k 9 . activity . compose . Recipient M vp View . Crypto Special Mode Display Type Ċ import Ġcom . fs ck . k 9 . activity . compose . Recipient M vp View . Crypto Status Display Type Ċ import Ġcom . fs ck . k 9 . activity . compose . Recipient Presenter . Crypto Mode Ċ import Ġcom . fs ck . k 9 . autoc rypt . Aut oc rypt Draft State Header Parser Ċ import Ġcom . fs ck . k 9 . helper . Reply To Parser Ċ import Ġcom . fs ck . k 9 . helper . Reply To Parser . Reply To Addresses Ċ import Ġcom . fs ck . k 9 . mail . Address Ċ import Ġcom . fs ck . k 9 . mail . Message Ċ import Ġcom . fs ck . k 9 . mail . Message . Recipient Type Ċ import Ġcom . fs ck . k 9 . message . Aut oc rypt Status Interactor Ċ import Ġcom . fs ck . k 9 . message . Aut oc rypt Status Interactor . Recipient Aut oc rypt Status Ċ import Ġcom . fs ck . k 9 . message . Aut oc rypt Status Interactor . Recipient Aut oc rypt StatusType Ċ import Ġcom . fs ck . k 9 . message . Compose P gp Enable ByDefault Dec ider Ċ import Ġcom . fs ck . k 9 . message . Compose P gp Inline Dec ider Ċ import Ġcom . fs ck . k 9 . view . Recipient Select View . Recipient Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġkotlin . test . assertNotNull Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Ignore Ċ import Ġorg . junit . Test Ċ import Ġorg . k oin . test . inject Ċ import Ġorg . mockito . Argument Matchers . eq Ċ import Ġorg . mockito . Mockito . verify Ċ import Ġorg . mockito . kotlin . any Ċ import Ġorg . mockito . kotlin . do Answer Ċ import Ġorg . mockito . kotlin . do Return Ċ import Ġorg . mockito . kotlin . mock Ċ import Ġorg . mockito . kotlin . stub bing Ċ import Ġorg . open int ents . open pgp . Open P gp Api Manager Ċ import Ġorg . open int ents . open pgp . Open P gp Api Manager . Open P gp Api Manager Callback Ċ import Ġorg . open int ents . open pgp . Open P gp Api Manager . Open P gp Provider State Ċ import Ġorg . open int ents . open pgp . util . Open P gp Api Ċ import Ġorg . ro bo lectric . Ro bo lectric Ċ import Ġorg . ro bo lectric . annotation . Looper Mode Ċ Ċ private Ġval ĠTO _ ADDRESS Ġ= ĠAddress (" to @ domain . example ") Ċ private Ġval ĠCC _ ADDRESS Ġ= ĠAddress (" cc @ domain . example ") Ċ private Ġconst Ġval ĠCR YPTO _ PROVIDER Ġ= Ġ" crypto _ provider " Ċ private Ġconst Ġval ĠCR YPTO _ KEY _ ID Ġ= Ġ 1 2 3 L Ċ Ċ @ Looper Mode ( Looper Mode . Mode . LEG ACY ) Ċ class ĠRe cipient Presenter Test Ġ: ĠK 9 Ro bo lectric Test () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġopen P gp Api Manager Ġ= Ġmock < Open P gp Api Manager > Ġ{ ĊĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Provider State Ġ} Ġdo Return ĠOpen P gp Provider State . UN CONFIGURE D ĊĠĠĠĠĠĠĠ Ġon Ġ{ Ġset Open P gp Provider ( any (), Ġany ()) Ġ} Ġdo Answer Ġ{ Ġinvocation Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġopen P gp Api Manager Callback Ġ= Ġinvocation . get Argument ( 1 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġrecipient M vp View Ġ= Ġmock < Recipient M vp View >() ĊĠĠĠ Ġprivate Ġval Ġaccount Ġ= Ġmock < Account >() ĊĠĠĠ Ġprivate Ġval Ġcompose P gp Inline Dec ider Ġ= Ġmock < Compose P gp Inline Dec ider >() ĊĠĠĠ Ġprivate Ġval Ġcompose P gp Enable ByDefault Dec ider Ġ= Ġmock < Compose P gp Enable ByDefault Dec ider >() ĊĠĠĠ Ġprivate Ġval Ġautoc rypt Status Interactor Ġ= Ġmock < Aut oc rypt Status Interactor >() ĊĠĠĠ Ġprivate Ġval Ġreply To Parser Ġ= Ġmock < Reply To Parser >() ĊĠĠĠ Ġprivate Ġval Ġautoc rypt Draft State Header Parser : ĠAut oc rypt Draft State Header Parser Ġby Ġinject () ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġrecipient Presenter : ĠRe cipient Presenter ĊĊĠĠĠ Ġprivate Ġval Ġno Recipients Aut oc rypt Result Ġ= ĠRe cipient Aut oc rypt Status ( Recipient Aut oc rypt StatusType . NO _ RE CI PI ENTS , Ġnull ) ĊĠĠĠ Ġprivate Ġvar Ġopen P gp Api Manager Callback : ĠOpen P gp Api Manager Callback ? Ġ= Ġnull ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠRo bo lectric . get Background Thread Scheduler (). pause () ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter Ġ= ĠRe cipient Presenter ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠApplication Provider . getApplicationContext (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmock (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġopen P gp Api Manager , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrecipient M vp View , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġaccount , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompose P gp Inline Dec ider , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompose P gp Enable ByDefault Dec ider , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġautoc rypt Status Interactor , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreply To Parser , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġautoc rypt Draft State Header Parser ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Ignore (" It Ġlooks Ġlike Ġthe Ġsupport Ġversion Ġof ĠAsync Task Loader Ġhandles Ġbackground Ġtasks Ġdifferently ") ĊĠĠĠ Ġfun Ġtest Init From Reply To Message () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= Ġmock < Message >() ĊĠĠĠĠĠĠĠ Ġstub bing ( reply To Parser ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġget Recipients To Reply To ( message , Ġaccount ) Ġ} Ġdo Return ĠReply To Addresses ( array Of ( TO _ ADDRESS )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . init From Reply To Message ( message , Ġfalse ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ Ġverify ( recipient M vp View ). add Recipients ( eq ( Recipient Type . TO ), Ġeq ( Recipient ( TO _ ADDRESS ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Ignore (" It Ġlooks Ġlike Ġthe Ġsupport Ġversion Ġof ĠAsync Task Loader Ġhandles Ġbackground Ġtasks Ġdifferently ") ĊĠĠĠ Ġfun Ġtest Init From Reply To All Message () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= Ġmock < Message >() ĊĠĠĠĠĠĠĠ Ġval Ġreply To Addresses Ġ= ĠReply To Addresses ( listOf ( TO _ ADDRESS ), ĠlistOf ( CC _ ADDRESS )) ĊĠĠĠĠĠĠĠ Ġstub bing ( reply To Parser ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġget Recipients To Reply All To ( message , Ġaccount ) Ġ} Ġdo Return Ġreply To Addresses ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . init From Reply To Message ( message , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ Ġverify ( recipient M vp View ). add Recipients ( eq ( Recipient Type . TO ), Ġeq ( Recipient ( TO _ ADDRESS ))) ĊĠĠĠĠĠĠĠ Ġverify ( recipient M vp View ). add Recipients ( eq ( Recipient Type . CC ), Ġeq ( Recipient ( CC _ ADDRESS ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġinit From Reply To Message _ should Call Compose P gp Inline Dec ider () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Ġ= Ġmock < Message >() ĊĠĠĠĠĠĠĠ Ġstub bing ( reply To Parser ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġget Recipients To Reply To ( message , Ġaccount ) Ġ} Ġdo Return ĠReply To Addresses ( array Of ( TO _ ADDRESS )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . init From Reply To Message ( message , Ġfalse ) ĊĊĠĠĠĠĠĠĠ Ġverify ( compose P gp Inline Dec ider ). should Reply Inline ( message ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ without Crypto Provider () Ġ{ ĊĠĠĠĠĠĠĠ Ġstub bing ( open P gp Api Manager ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Provider State Ġ} Ġdo Return ĠOpen P gp Provider State . UN CONFIGURE D ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . async Update Crypto Status () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . UN CONFIGURE D ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . special Mode Display Type ). isEqualTo ( Crypto Special Mode Display Type . NONE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . attach Error State OrNull ). isNull () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isFalse () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isFalse () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Crypto Provider () Ġ{ ĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( no Recipients Aut oc rypt Result ) ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . UN AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Opp ort un istic () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . AVAILABLE _ UN CON FI R MED , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Opp ort un istic __ confirmed () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . AVAILABLE _ CON FI R MED , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Opp ort un istic __ missing Keys () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . UN AVAILABLE , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . UN AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Opp ort un istic __ private Missing Keys () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . UN AVAILABLE , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Crypto Mode Changed ( Crypto Mode . CHO ICE _ ENABLED ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . ENABLED _ ERROR ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Mode Disabled () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . AVAILABLE _ UN CON FI R MED , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Crypto Mode Changed ( Crypto Mode . CHO ICE _ DISABLED ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Mode Private () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrecipient Aut oc rypt Status Ġ= ĠRe cipient Aut oc rypt Status ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠRe cipient Aut oc rypt StatusType . AVAILABLE _ UN CON FI R MED , Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( recipient Aut oc rypt Status ) ĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Crypto Mode Changed ( Crypto Mode . CHO ICE _ ENABLED ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . ENABLED ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Mode Sign Only () Ġ{ ĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( no Recipients Aut oc rypt Result ) ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Menu Set Sign Only ( true ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . SIGN _ ONLY ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . isOpen P gp Configured ). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Sign Only ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠgetCurrent Crypto Status _ with Mode Inline () Ġ{ ĊĠĠĠĠĠĠĠ Ġsetup Crypto Provider ( no Recipients Aut oc rypt Result ) ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Menu Set P gp Inline ( true ) ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( recipient Presenter . current Cached Crypto Status ) Ġ{ Ġstatus Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . display Type ). isEqualTo ( Crypto Status Display Type . UN AVAILABLE ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is Provider State Ok ()). isTrue () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( status . is P gp Inline Mode Enabled ). isTrue () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġrun Background Task () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat ( Ro bo lectric . get Background Thread Scheduler (). run One Task ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Crypto Provider ( autoc rypt Status Result : ĠRe cipient Aut oc rypt Status ) Ġ{ ĊĠĠĠĠĠĠĠ Ġstub bing ( account ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Provider Ġ} Ġdo Return ĠCR YPTO _ PROVIDER ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ ĠisOpen P gp Provider Configured Ġ} Ġdo Return Ġtrue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Key Ġ} Ġdo Return ĠCR YPTO _ KEY _ ID ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġrecipient Presenter . on Switch Account ( account ) ĊĊĠĠĠĠĠĠĠ Ġval Ġopen P gp Api Mock Ġ= Ġmock < Open P gp Api >() ĊĊĠĠĠĠĠĠĠ Ġstub bing ( autoc rypt Status Interactor ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġretrieve Crypto Provider Recipient Status ( eq ( open P gp Api Mock ), Ġany ()) Ġ} Ġdo Return Ġautoc rypt Status Result ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġstub bing ( open P gp Api Manager ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Api Ġ} Ġdo Return Ġopen P gp Api Mock ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġopen P gp Provider State Ġ} Ġdo Return ĠOpen P gp Provider State . OK ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġopen P gp Api Manager Callback !!. on Open P gp Provider Status Changed () ĊĠĠĠĠĠĠĠ Ġrun Background Task () ĊĠĠĠ Ġ} Ċ } Ċ