package Ġcom . coin ninja . coin keeper . ui . account . verify . twitter Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . test . core . app . Application Provider Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġapp . drop bit . twitter . Twitter Intent s Ċ import Ġapp . drop bit . twitter . model . Twitter User Ċ import Ġcom . coin ninja . coin keeper . ui . drop bit . me . Drop bit Me Configuration Ċ import Ġcom . coin ninja . coin keeper . util . Drop bit Intent s Ċ import Ġcom . coin ninja . coin keeper . util . android . Local Broad Cast Util Ċ import Ġcom . coin ninja . coin keeper . util . android . Service Work Util Ċ import Ġcom . coin ninja . coin keeper . util . android . activity . Activity Navigation Util Ċ import Ġcom . coin ninja . matchers . Intent Filter Matchers Ċ import Ġjunit . framework . Assert . assertNull Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mockito . mock Ċ import Ġorg . mockito . Mockito . verify Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠTwitter Verification Controller Test Ġ{ ĊĊĠĠĠ Ġfun Ġsetup (): ĠTwitter Verification Controller Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠTwitter Verification Controller ( mock ( Service Work Util :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmock ( Activity Navigation Util :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmock ( Drop bit Me Configuration :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmock ( Local Broad Cast Util :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` ob serves ĠTwitter ĠVerified Ġbroadcast s Ġwhen Ġstarted `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontroller Ġ= Ġsetup () ĊĊĠĠĠĠĠĠĠ Ġcontroller . on Started ( Application Provider . getApplicationContext (), Ġnull ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( controller . intent Filter , ĠIntent Filter Matchers . contains Action ( Drop bit Intent s . ACTION _ VERIFY _ TW IT TER _ COMPLETED )) ĊĠĠĠĠĠĠĠ Ġverify ( controller . local Broad Cast Util ). register Receiver ( controller , Ġcontroller . intent Filter ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` re moves Ġobserver Ġwhen Ġstopped `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontroller Ġ= Ġsetup () ĊĠĠĠĠĠĠĠ Ġcontroller . on Started ( Application Provider . getApplicationContext (), Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġcontroller . on Stopped () ĊĊĠĠĠĠĠĠĠ ĠassertNull ( controller . activity Context ) ĊĠĠĠĠĠĠĠ Ġverify ( controller . local Broad Cast Util ). unregister Receiver ( controller ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` ver ifies Ġwith Ġdrop bit Ġwhen Ġtwitter Ġuser Ġauthorized `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontroller Ġ= Ġsetup () ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= ĠApplication Provider . getApplicationContext < Context >() ĊĠĠĠĠĠĠĠ Ġcontroller . on Started ( context , Ġnull ) ĊĠĠĠĠĠĠĠ Ġval Ġtwitter User Ġ= ĠTwitter User () ĊĠĠĠĠĠĠĠ Ġtwitter User . screen Name Ġ= Ġ" J oh nn y Number 5 " ĊĠĠĠĠĠĠĠ Ġtwitter User . userId Ġ= Ġ 1 2 3 4 5 6 7 8 9 L ĊĠĠĠĠĠĠĠ Ġval Ġresult Data Ġ= ĠIntent () ĊĠĠĠĠĠĠĠ Ġresult Data . putExtra ( Twitter Intent s . TW IT TER _ USER , Ġtwitter User ) ĊĊĠĠĠĠĠĠĠ Ġcontroller . on Twitter Authorized ( result Data ) ĊĊĠĠĠĠĠĠĠ Ġverify ( controller . service Work Util ). add Verified Twitter Account ( 1 2 3 4 5 6 7 8 9 L ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` navig ates Ġto Ġhome Ġscreen Ġwith Ġdrop bit Ġconfigured Ġto Ġshow Ġ Ġwhen Ġverification Ġcompleted `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontroller Ġ= Ġsetup () ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= ĠApplication Provider . getApplicationContext < Context >() ĊĠĠĠĠĠĠĠ Ġcontroller . on Started ( context , Ġnull ) ĊĊĠĠĠĠĠĠĠ Ġcontroller . on Receive ( context , ĠIntent ( Drop bit Intent s . ACTION _ VERIFY _ TW IT TER _ COMPLETED )) ĊĊĠĠĠĠĠĠĠ Ġverify ( controller . drop bit Me Configuration ). setInitial Verification () ĊĠĠĠĠĠĠĠ Ġverify ( controller . activity Navigation Util ). navigate To Home ( controller . activity Context !! ) ĊĊĠĠĠ Ġ} Ċ }