package Ġcom . merc ad op ago . android . px . internal . mapper Ċ Ċ import Ġcom . merc ad op ago . android . px . internal . datasource . Custom Option Id Solver Ċ import Ġcom . merc ad op ago . android . px . internal . map pers . One Tap Item To Disabled PaymentMethod Mapper Ċ import Ġcom . merc ad op ago . android . px . internal . repository . Pay er PaymentMethod Key Ċ import Ġcom . merc ad op ago . android . px . model . Card Metadata Ċ import Ġcom . merc ad op ago . android . px . model . Status Metadata Ċ import Ġcom . merc ad op ago . android . px . model . internal . Application Ċ import Ġcom . merc ad op ago . android . px . model . internal . Disabled PaymentMethod Ċ import Ġcom . merc ad op ago . android . px . model . internal . One Tap Item Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . internal . matchers . apache commons . Reflection Equals Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ import Ġorg . mockito . kotlin . mock Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠOne Tap Item To Disabled PaymentMethod Mapper Test Ġ{ ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġone Tap Items : ĠList < One Tap Item > ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Map One Tap Item To Disabled PaymentMethod Without Offline Method () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard One Tap Item Ġ= Ġmake Card One Tap Item () ĊĠĠĠĠĠĠĠ Ġval Ġcard Application Ġ= Ġcard One Tap Item . get Applications ()[ 0 ] ĊĊĠĠĠĠĠĠĠ Ġone Tap Items Ġ= ĠlistOf ( card One Tap Item ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Key Ġ= ĠPay er PaymentMethod Key ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCustom Option Id Solver . getBy Application ( card One Tap Item , Ġcard Application ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcard Application . payment Method . type ) ĊĠĠĠĠĠĠĠ Ġval Ġexpected Disabled Method Ġ= ĠDisabled PaymentMethod ( card Application . payment Method . id ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠOne Tap Item To Disabled PaymentMethod Mapper (). map ( one Tap Items ) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( actual . size Ġ== Ġ 1 ) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( actual . containsKey ( expected Key )) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( Reflection Equals ( expected Disabled Method ). matches ( actual [ expected Key ])) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Map One Tap Item To Disabled PaymentMethod With Offline Method () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard One Tap Item Ġ= Ġmake Card One Tap Item () ĊĠĠĠĠĠĠĠ Ġval Ġcard Application Ġ= Ġcard One Tap Item . get Applications ()[ 0 ] ĊĊĠĠĠĠĠĠĠ Ġone Tap Items Ġ= ĠlistOf ( make Card One Tap Item (), Ġmake Offline One Tap Item ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Key Ġ= ĠPay er PaymentMethod Key ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCustom Option Id Solver . getBy Application ( card One Tap Item , Ġcard Application ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcard Application . payment Method . type ) ĊĠĠĠĠĠĠĠ Ġval Ġexpected Disabled Method Ġ= ĠDisabled PaymentMethod ( card Application . payment Method . id ) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠOne Tap Item To Disabled PaymentMethod Mapper (). map ( one Tap Items ) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( actual . size Ġ== Ġ 1 ) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( actual . containsKey ( expected Key )) ĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( Reflection Equals ( expected Disabled Method ). matches ( actual [ expected Key ])) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen Map One Tap Item To Disabled PaymentMethod With Only Offline Method () Ġ{ ĊĠĠĠĠĠĠĠ Ġone Tap Items Ġ= ĠlistOf ( make Offline One Tap Item ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= ĠOne Tap Item To Disabled PaymentMethod Mapper (). map ( one Tap Items ) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertTrue ( actual . isEmpty ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmake Card One Tap Item (): ĠOne Tap Item Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcard : ĠCard Metadata Ġ= Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġid Ġ}. thenReturn (" 1 2 3 4 5 6 ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcard Application Status : ĠStatus Metadata Ġ= Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġis Enabled Ġ}. thenReturn ( false ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcard Application PaymentMethod : ĠApplication . PaymentMethod Ġ= Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġid Ġ}. thenReturn (" visa ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġtype Ġ}. thenReturn (" credit _ card ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġcard Application : ĠApplication Ġ= Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġpayment Method Ġ}. thenReturn ( card Application PaymentMethod ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġstatus Ġ}. thenReturn ( card Application Status ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġis Card Ġ}. thenReturn ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġthis . card Ġ}. thenReturn ( card ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġget Applications () Ġ}. thenReturn ( listOf ( card Application )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġmake Offline One Tap Item (): ĠOne Tap Item Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġoffline Application : ĠApplication Ġ= Ġmock () ĊĊĠĠĠĠĠĠĠ Ġreturn Ġmock Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġis Offline Methods Ġ}. thenReturn ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġget Applications () Ġ}. thenReturn ( listOf ( offline Application )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }