package Ġcom . br aint re ep ay ments . api Ċ Ċ import Ġandroid . app . Activity . RESULT _ FIRST _ USER Ċ import Ġandroid . app . Activity . RESULT _ OK Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġcom . br aint re ep ay ments . api . Drop In Client . EXTRA _ CHECK OUT _ REQUEST Ċ import Ġcom . br aint re ep ay ments . card form . utils . Card Type Ċ import Ġjunit . framework . TestCase .* Ċ import Ġorg . json . JSONObject Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Ignore Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mockito .* Ċ import Ġorg . ro bo lectric . Ro bo lectric . build Activity Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . Shadow s . shadow Of Ċ import Ġorg . ro bo lectric . android . controller . Activity Controller Ċ import Ġjava . util .* Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠDrop In Activity Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity Controller : ĠActivity Controller < Drop In Activity > ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠDrop In Activity ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġauthorization : ĠAuthorization ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġdrop In Request : ĠDrop In Request ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠbeforeEach () Ġ{ ĊĠĠĠĠĠĠĠ Ġauthorization Ġ= ĠAuthorization . fromString ( Fixtures . TOKEN IZATION _ KEY ) ĊĠĠĠĠĠĠĠ Ġdrop In Request Ġ= ĠDrop In Request () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After ĊĠĠĠ Ġfun ĠafterEach () Ġ{ ĊĠĠĠĠĠĠĠ Ġactivity Controller . stop () ĊĠĠĠĠĠĠĠ Ġactivity Controller . destroy () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġregion ĠonCreate ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠonCreate _ when Authorization Is Invalid _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthorization Ġ= ĠInvalid Authorization (" not Ġa Ġtoken ization Ġkey ", Ġ" error Ġmessage ") ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġexception Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertTrue ( exception Ġis ĠInvalidArgumentException ) ĊĠĠĠĠĠĠĠ ĠassertEquals (" Token ization ĠKey Ġor ĠClient ĠToken Ġwas Ġinvalid .", Ġexception !!. message ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠBrowser ĠSwitch ĠResults ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ deli vers Browser Switch Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). deliver Browser Switch Result ( same ( activity ), Ġany ( Drop In Result Callback :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Success Result Will Be Deliver ed _ updates Drop In State To FIN ISH ING () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Browser Switch Result ( create Browser Switch Success Result ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( Drop In State . W ILL _ FIN ISH , Ġactivity . drop In ViewModel . drop In State . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Result Exists _ fin ishes With Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġdrop In Request . three D Secure Request Ġ= ĠThree D Secure Request () ĊĊĠĠĠĠĠĠĠ Ġval Ġpayment Method Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Result Ġ= ĠDrop In Result () ĊĠĠĠĠĠĠĠ Ġdrop In Result . payment Method Nonce Ġ= Ġpayment Method Nonce ĊĠĠĠĠĠĠĠ Ġdrop In Result . device Data Ġ= Ġ" device Ġdata " ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. deliver Browser Switch Result Success ( drop In Result ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ OK , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( drop In Result , Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Returns User Canceled Exception _ sets User Canceled Error In ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠUser Canceled Exception (" User Ġcanceled Ġ 3 DS .") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. deliver Browse Switch Result Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġactivity . drop In ViewModel . user Canceled Error . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Error _ forward s Error () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" A Ġ 3 DS Ġerror ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. deliver Browse Switch Result Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" sdk . exit . sdk - error ") ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Result Exists _ send Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayment Method Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Result Ġ= ĠDrop In Result () ĊĠĠĠĠĠĠĠ Ġdrop In Result . payment Method Nonce Ġ= Ġpayment Method Nonce ĊĠĠĠĠĠĠĠ Ġdrop In Result . device Data Ġ= Ġ" device Ġdata " ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. deliver Browser Switch Result Success ( drop In Result ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" sdk . exit . success ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Resume _ when Browser Switch Result Exists _ stores Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayment Method Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Result Ġ= ĠDrop In Result () ĊĠĠĠĠĠĠĠ Ġdrop In Result . payment Method Nonce Ġ= Ġpayment Method Nonce ĊĠĠĠĠĠĠĠ Ġdrop In Result . device Data Ġ= Ġ" device Ġdata " ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. deliver Browser Switch Result Success ( drop In Result ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). set Last Used Payment MethodType ( activity , Ġpayment Method Nonce ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠActivity ĠResults ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Activity Result _ when Drop In Result Exists _ fin ishes Activity () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpayment Method Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Result Ġ= ĠDrop In Result () ĊĠĠĠĠĠĠĠ Ġdrop In Result . payment Method Nonce Ġ= Ġpayment Method Nonce ĊĠĠĠĠĠĠĠ Ġdrop In Result . device Data Ġ= Ġ" device Ġdata " ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. handle Activity Result Success ( drop In Result ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġactivity . on Activity Result ( B ra int ree Request Codes . TH REE _ D _ SECURE , ĠRESULT _ OK , Ġmock ( Intent :: class . java )) ĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ OK , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( drop In Result , Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Activity Result _ when Result Is User Canceled Exception _ sets User Canceled Error In ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠUser Canceled Exception (" User Ġcanceled Ġ 3 DS .") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. handle Activity Result Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġactivity . on Activity Result ( B ra int ree Request Codes . TH REE _ D _ SECURE , ĠRESULT _ OK , Ġmock ( Intent :: class . java )) ĊĠĠĠĠĠĠĠ ĠassertFalse ( activity . is Finish ing ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġactivity . drop In ViewModel . user Canceled Error . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Activity Result _ when Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" A Ġ 3 DS Ġerror ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. handle Activity Result Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġactivity . on Activity Result ( B ra int ree Request Codes . TH REE _ D _ SECURE , ĠRESULT _ OK , Ġmock ( Intent :: class . java )) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" sdk . exit . sdk - error ") ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġshadow Activity . result Intent . get Serializable Extra ( Drop In Result . EXTRA _ ERROR )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠSend ĠAnalytics ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Send Analytics Event _ s ends Analytics Via Drop In Client () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Event Ġ= ĠDrop In Event . create Send Analytics Event (" test - analytics . event ") ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġdrop In Event . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" test - analytics . event ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠVault ed ĠPayment ĠMethod ĠSelected ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ when Card _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Event Ġ= ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġdrop In Event . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" vault ed - card . select ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ when Pay Pal _ does Not Send Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpay Pal Account Nonce Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠPay Pal Account Nonce . from JSON ( JSONObject ( Fixtures . PAY PAL _ ACCOUNT _ JSON )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Event Ġ= ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( pay Pal Account Nonce ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġdrop In Event . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client , Ġnever ()). send Analytics Event (" vault ed - card . select ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ when 3 DS Fails _ re loads Payment Methods And Fin ishes () Ġ{ ĊĠĠĠĠĠĠĠ Ġauthorization Ġ= ĠAuthorization . fromString ( UnitTest Fixtures Helper . base 6 4 Encoded Client Token From Fixture ( Fixtures . CLIENT _ TOKEN )) ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" three Ġd Ġsecure Ġfailure ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. three D Secure Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġthree D Secure Request Ġ= ĠThree D Secure Request () ĊĠĠĠĠĠĠĠ Ġthree D Secure Request . amount Ġ= Ġ" 1 . 0 0 " ĊĊĠĠĠĠĠĠĠ Ġval Ġdrop In Request Ġ= ĠDrop In Request () ĊĠĠĠĠĠĠĠ Ġdrop In Request . three D Secure Request Ġ= Ġthree D Secure Request ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ). to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). get Vault ed Payment Methods ( same ( activity ), Ġany ( Get PaymentMethod Non ces Callback :: class . java )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġshadow Activity . result Intent . get Serializable Extra ( Drop In Result . EXTRA _ ERROR )) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ when Should Not Request 3 DS _ returns AN once () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. collect Device Data Success (" sample - data ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ). to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client , Ġnever ()). perform Three D Secure Verification ( same ( activity ), Ġsame ( card Nonce ), Ġany ( Drop In Result Callback :: class . java )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ OK , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġshadow Activity . result Intent . get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT ) Ġas ĠDrop In Result ? ĊĠĠĠĠĠĠĠ ĠassertEquals ( card Nonce . string , Ġresult !!. payment Method Nonce !!. string ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ when Should Not Request 3 DS _ on Device Data Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. collect Device Data Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ). to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed Payment Selected Event _ when Should Perform 3 DS Verification _ requests 3 DS Verification () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ). to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). perform Three D Secure Verification ( same ( activity ), Ġsame ( card Nonce ), Ġany ( Drop In Result Callback :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Vault ed PaymentMethod Selected Event _ returns Device Data () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. collect Device Data Success (" device - data ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , ĠDrop In Event . create Vault ed PaymentMethod Selected Event ( card Nonce ). to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġshadow Activity . result Intent . get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT ) Ġas ĠDrop In Result ? ĊĠĠĠĠĠĠĠ ĠassertEquals (" device - data ", Ġresult !!. device Data ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠDelete ĠPayment ĠMethod ĠN once ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠonDelete PaymentMethod Nonce Event _ when Dialog Confirmed _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġalert Presenter Ġ= Ġmock ( Alert Presenter :: class . java ) ĊĠĠĠĠĠĠĠ Ġdo Answer Ġ{ Ġinvocation Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcallback Ġ= Ġinvocation . arguments [ 2 ] Ġas ĠDialog Interaction Callback ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcallback . on Dialog Interaction ( Dialog Interaction . POSITIVE ) ĊĠĠĠĠĠĠĠ Ġ}. ` when `( alert Presenter ). show Confirm Nonce Deletion Dialog ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Context :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( PaymentMethod Nonce :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Dialog Interaction Callback :: class . java ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . alert Presenter Ġ= Ġalert Presenter ĊĠĠĠĠĠĠĠ Ġactivity . on Drop In Event ( Drop In Event . create Delete Vault ed PaymentMethod Nonce Event ( card Nonce )) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" manager . delete . confirmation . positive ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun ĠonDelete PaymentMethod Nonce Event _ when Dialog Cancelled _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġval Ġalert Presenter Ġ= Ġmock ( Alert Presenter :: class . java ) ĊĠĠĠĠĠĠĠ Ġdo Answer Ġ{ Ġinvocation Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcallback Ġ= Ġinvocation . arguments [ 2 ] Ġas ĠDialog Interaction Callback ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcallback . on Dialog Interaction ( Dialog Interaction . NEGATIVE ) ĊĠĠĠĠĠĠĠ Ġ}. ` when `( alert Presenter ). show Confirm Nonce Deletion Dialog ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Context :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( PaymentMethod Nonce :: class . java ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġany ( Dialog Interaction Callback :: class . java ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . alert Presenter Ġ= Ġalert Presenter ĊĠĠĠĠĠĠĠ Ġactivity . on Drop In Event ( Drop In Event . create Delete Vault ed PaymentMethod Nonce Event ( card Nonce )) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" manager . delete . confirmation . negative ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠRemove ĠPayment ĠMethod ĠN once ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġremove PaymentMethod Nonce _ when Nonce NotNull _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. delete PaymentMethod Success ( card Nonce ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . remove PaymentMethod Nonce ( card Nonce ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" manager . delete . succeeded ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġremove PaymentMethod Nonce _ when PaymentMethod Delete Exception _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. delete PaymentMethod Error ( PaymentMethod Delete Exception ( card Nonce , ĠException (" error "))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . remove PaymentMethod Nonce ( card Nonce ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" manager . delete . failed ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġremove PaymentMethod Nonce _ when Unknown Error _ s ends Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. delete PaymentMethod Error ( Exception (" error ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġactivity . remove PaymentMethod Nonce ( card Nonce ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" manager . unknown . failed ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġremove PaymentMethod Nonce _ onError _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. delete PaymentMethod Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġactivity . remove PaymentMethod Nonce ( mock ( PaymentMethod Nonce :: class . java )) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠSupported ĠPayment ĠMethod ĠSelected ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Pay Pal _ token izes Pay Pal () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . PAY PAL ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). tokenize Pay Pal Request ( same ( activity ), Ġany ( Pay Pal Flow Started Callback :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Pay Pal _ on Pay Pal Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. pay Pal Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . PAY PAL ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Ven mo _ token izes Ven mo () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . VEN MO ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). tokenize Ven mo Account ( same ( activity ), Ġany ( Ven mo Token ize Account Callback :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Ven mo _ on Ven mo Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. ven mo Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . VEN MO ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Google Pay _ token izes Google Pay () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . GOOGLE _ PAY ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). request Google Pay Payment ( same ( activity ), Ġany ( Google Pay Request Payment Callback :: class . java )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Google Pay _ on Google Pay Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. google Pay Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . GOOGLE _ PAY ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Unknown _ shows Add Card Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . UNKNOWN ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . execute Pending Transactions () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( activity . support FragmentManager . find Fragment By Tag (" ADD _ CARD ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Unknown _ pref etches Supported Card Types () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsupported Card Types Ġ= Ġarray ListOf ( Card Type . VIS A ) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Card Types Success ( supported Card Types ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . UNKNOWN ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( Card Type . VIS A , Ġactivity . drop In ViewModel . supported Card Types . value ! ![ 0 ]) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Unknown _ on Get Supported Card Types Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Card Types Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . UNKNOWN ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Supported PaymentMethod Selected Event _ with Type Unknown _ on Card Types Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Supported PaymentMethod Selected Event ( Drop In PaymentMethod . UNKNOWN ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠAdd ĠCard ĠSubmit ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Add Card Submit Event _ shows Card Details Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. getConfiguration Success ( Configuration . fromJson ( Fixtures . CONFIGURATION _ WITH _ GOOGLE _ PAY _ AND _ CARD _ AND _ PAY PAL )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Add Card Submit Event (" 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ") ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . execute Pending Transactions () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( activity . support FragmentManager . find Fragment By Tag (" CARD _ DETAILS ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠEdit ĠCard ĠNumber ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Edit Card Number Event _ shows Add Card Fragment () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠDrop In Event . create Edit Card Number Event (" 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ") ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . execute Pending Transactions () ĊĊĠĠĠĠĠĠĠ ĠassertNotNull ( activity . support FragmentManager . find Fragment By Tag (" ADD _ CARD ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠCard ĠDetails ĠSubmit ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Card Details Submit Event _ on Token ize Card Success _ when Should Not Request 3 DS _ fin ishes With Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. card Token ize Success ( card Nonce ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( false ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event . create Card Details Submit Event ( Card ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ OK , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġshadow Activity . result Intent . get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT ) Ġas ĠDrop In Result ? ĊĠĠĠĠĠĠĠ ĠassertEquals ( card Nonce . string , Ġresult !!. payment Method Nonce !!. string ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Card Details Submit Event _ on Token ize Card Success _ when Should Request 3 DS _ on 3 D SS uccess _ fin ishes With Result () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Result Ġ= ĠDrop In Result () ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. card Token ize Success ( card Nonce ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. three D Secure Success ( drop In Result ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event . create Card Details Submit Event ( Card ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ OK , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġshadow Activity . result Intent . get Parcelable Extra ( Drop In Result . EXTRA _ DROP _ IN _ RESULT ) Ġas ĠDrop In Result ? ĊĠĠĠĠĠĠĠ ĠassertSame ( result , Ġdrop In Result ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Card Details Submit Event _ on Token ize Card Success _ when Should Request 3 DS _ on 3 D SError _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard Nonce Ġ= ĠCard Nonce . from JSON ( JSONObject ( Fixtures . VIS A _ CRED IT _ CARD _ RESPONSE )) ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. card Token ize Success ( card Nonce ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. should Perform Three D Secure Verification ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. three D Secure Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event . create Card Details Submit Event ( Card ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Card Details Submit Event _ onError _ when Error With Response _ sets Card Token ization Error In ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠError With Response . fromJson ( Fixtures . CRED IT _ CARD _ ERROR _ RESPONSE ) ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. card Token ize Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event . create Card Details Submit Event ( Card ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( error , Ġactivity . drop In ViewModel . card Token ization Error . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Card Details Submit Event _ onError _ when Error Not With Response _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. card Token ize Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event . create Card Details Submit Event ( Card ()) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ? ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠShow ĠVault ĠManager ĠEvent ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Show Vault Manager Event _ on Vault ed Payment Methods Success _ sets Vault ed Payment Methods In ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġvault ed Payment Methods Ġ= ĠArrayList < PaymentMethod Nonce >() ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Vault ed Payment Methods Success ( vault ed Payment Methods ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event ( Drop In EventType . SHOW _ VA ULT _ MANAGER ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertSame ( vault ed Payment Methods , Ġactivity . drop In ViewModel . vault ed Payment Methods . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Show Vault Manager Event _ on Vault ed Payment Methods Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Vault ed Payment Methods Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠDrop In Event ( Drop In EventType . SHOW _ VA ULT _ MANAGER ) ĊĠĠĠĠĠĠĠ Ġactivity . support FragmentManager . set Fragment Result ( Drop In Event . REQUEST _ KEY , Ġevent . to Bundle ()) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠBottom ĠSheet ĠState ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Ignore ĊĠĠĠ Ġfun Ġon Back Pressed _ sets Drop In ViewModel Bottom Sheet State Hide Requested () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠTODO : ĠIn ves igate Ġif Ġthe Ġon Back Pressed Ġcode Ġpath Ġis Ġneeded Ġin ĠDrop In Activity Ġ- Ġdoesn 't Ġappear Ġto Ġever Ġget Ġhit ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Did Hide Bottom Sheet _ when No Result Present _ send Analytics Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . HIDDEN ) ĊĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" sdk . exit . c anceled ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Did Show Bottom Sheet _ when Client Token Present _ on Get Vault ed Payment Methods Success _ sets Vault ed Payments In ViewModel () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġvault ed Payment Methods Ġ= ĠArrayList < PaymentMethod Nonce >() ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( Authorization . fromString ( Fixtures . BASE 6 4 _ CLIENT _ TOKEN )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Vault ed Payment Methods Success ( vault ed Payment Methods ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . SHO WN ) ĊĊĠĠĠĠĠĠĠ ĠassertSame ( vault ed Payment Methods , Ġactivity . drop In ViewModel . vault ed Payment Methods . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġon Did Show Bottom Sheet _ when Client Token Present _ on Get Vault ed Payment Methods Error _ fin ishes WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġerror Ġ= ĠException (" error ") ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( Authorization . fromString ( Fixtures . BASE 6 4 _ CLIENT _ TOKEN )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Supported Payment Methods Success ( ArrayList ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Vault ed Payment Methods Error ( error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( drop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġactivity . drop In ViewModel . set Bottom Sheet State ( Bottom Sheet State . SHO WN ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Error Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ĊĠĠĠĠĠĠĠ ĠassertSame ( error , Ġactual Error ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠErrors ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġconfiguration Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" configuration - exception ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠConfiguration Exception (" Configuration Ġexception ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġauthentication Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" developer - error ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAuthentication Exception (" Access Ġdenied ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġauthorization Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" developer - error ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAuthorization Exception (" Access Ġdenied ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġupgrade Required Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" developer - error ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUpgrade Required Exception (" Exception ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġserver Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" server - error ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠServer Exception (" Exception ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġunexpected Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" server - error ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUnexpected Exception (" Exception ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdown For Maintenance Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" server - un available ", ĊĠĠĠĠĠĠĠĠĠĠĠ ĠService Unavailable Exception (" Exception ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġany Exception Ex its Activity WithError () Ġ{ ĊĠĠĠĠĠĠĠ Ġassert Exception Is Returned (" sdk - error ", Ġjava . lang . Exception (" Error ! ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region ĊĊĠĠĠ Ġ// Ġregion ĠHelpers ĊĊĠĠĠ Ġprivate Ġfun Ġsetup Drop In Activity ( drop In Client : ĠDrop In Client , Ġdrop In Request : Drop In Request ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= ĠInstrument ation Registry . get Instrumentation (). target Context ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Request Bundle Ġ= ĠBundle () ĊĠĠĠĠĠĠĠ Ġdrop In Request Bundle . put Parcelable ( EXTRA _ CHECK OUT _ REQUEST , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent ( context , ĠDrop In Activity :: class . java ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra ( Drop In Client . EXTRA _ CHECK OUT _ REQUEST _ B UNDLE , Ġdrop In Request Bundle ) ĊĊĠĠĠĠĠĠĠ Ġactivity Controller Ġ= Ġbuild Activity ( Drop In Activity :: class . java , Ġintent ) ĊĠĠĠĠĠĠĠ Ġactivity Ġ= Ġactivity Controller . get () ĊĠĠĠĠĠĠĠ Ġactivity . drop In Client Ġ= Ġdrop In Client ĊĠĠĠĠĠĠĠ Ġactivity Controller . setup () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġassert Exception Is Returned ( analytics Event : ĠString , Ġexception : Ġjava . lang . Exception ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdrop In Client Ġ= ĠMock Drop In Client Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. authorization ( authorization ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġsetup Drop In Activity ( Ġdrop In Client , Ġdrop In Request ) ĊĠĠĠĠĠĠĠ Ġval Ġshadow Activity Ġ= Ġshadow Of ( activity ) ĊĊĠĠĠĠĠĠĠ Ġactivity . onError ( exception ) ĊĠĠĠĠĠĠĠ Ġverify ( drop In Client ). send Analytics Event (" sdk . exit .$ analytics Event ") ĊĠĠĠĠĠĠĠ ĠassertTrue ( activity . is Finish ing ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( RESULT _ FIRST _ USER , Ġshadow Activity . result Code ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Exception Ġ= Ġshadow Activity . result Intent ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Serializable Extra ( Drop In Result . EXTRA _ ERROR ) Ġas ĠException ĊĠĠĠĠĠĠĠ ĠassertSame ( exception , Ġactual Exception ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcreate Browser Switch Success Result (): ĠBrowser Switch Result Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrequest Code Ġ= Ġ 1 2 3 ĊĠĠĠĠĠĠĠ Ġval Ġurl Ġ= ĠUri . parse (" https :// example . com ") ĊĠĠĠĠĠĠĠ Ġval Ġmetadata Ġ= ĠJSONObject () ĊĠĠĠĠĠĠĠ Ġval Ġreturn Url Scheme Ġ= Ġ" sample - scheme " ĊĠĠĠĠĠĠĠ Ġval Ġbrowser Switch Request Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBrowser Switch Request ( request Code , Ġurl , Ġmetadata , Ġreturn Url Scheme , Ġtrue ) ĊĠĠĠĠĠĠĠ Ġreturn ĠBrowser Switch Result ( Browser Switch Status . SUCCESS , Ġbrowser Switch Request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// Ġend region Ċ }