package Ġcom . world pay . access . checkout . validation . configuration Ċ Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . argument Captor Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . eq Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . mock Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . never Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . world pay . access . checkout . api . Callback Ċ import Ġcom . world pay . access . checkout . api . configuration . Card Configuration Ċ import Ġcom . world pay . access . checkout . api . configuration . Card Configuration Client Ċ import Ġcom . world pay . access . checkout . test utils . Card Configuration Util . Configurations . CARD _ CONFIG _ BASIC Ċ import Ġcom . world pay . access . checkout . test utils . Card Configuration Util . Configurations . CARD _ CONFIG _ NO _ B RAND Ċ import Ġcom . world pay . access . checkout . test utils . Card Configuration Util . mock Successful Card Configuration Ċ import Ġkotlin . test . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ Ċ class ĠCard Configuration Provider Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval ĠbaseUrl Ġ= Ġ" localhost " ĊĠĠĠ Ġprivate Ġval Ġcard Configuration Client Ġ= Ġmock < Card Configuration Client >() ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcard Configuration Provider : ĠCard Configuration Provider ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġcard Configuration Provider Ġ= ĠCard Configuration Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠbaseUrl Ġ= ĠbaseUrl , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcard Configuration Client Ġ= Ġcard Configuration Client , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġob servers Ġ= Ġempty List () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġbe Ġgetting Ġdefault Ġcard Ġconfiguration Ġinitially `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġreset Ġback Ġto Ġdefault Ġcard Ġconfiguration Ġeach Ġtime Ġa Ġprovider Ġis Ġcreated Ġdespite Ġhaving Ġremote Ġcard Ġconfiguration Ġbefore `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĊĠĠĠĠĠĠĠ Ġmock Successful Card Configuration () ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ BASIC , ĠCard Configuration Provider . get Card Configuration ()) ĊĊĠĠĠĠĠĠĠ ĠCard Configuration Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠbaseUrl Ġ= ĠbaseUrl , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcard Configuration Client Ġ= Ġcard Configuration Client , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġob servers Ġ= Ġempty List () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġbe Ġgetting Ġremote Ġcard Ġconfiguration Ġonce Ġloaded `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Configuration Client Ġ= Ġmock < Card Configuration Client >() ĊĠĠĠĠĠĠĠ Ġval ĠbaseUrl Ġ= Ġ" https :// localhost - mock : 8 4 4 3 " ĊĠĠĠĠĠĠĠ Ġval Ġcapt or Ġ= Ġargument Captor < Callback < Card Configuration >>() ĊĊĠĠĠĠĠĠĠ ĠCard Configuration Provider ( baseUrl , Ġcard Configuration Client , Ġempty List ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( card Configuration Client ). get Card Configuration ( eq ( baseUrl ), Ġcapt or . capture ()) ĊĊĠĠĠĠĠĠĠ Ġcapt or . first Value . on Response ( null , ĠC ARD _ CONFIG _ BASIC ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ BASIC , ĠCard Configuration Provider . get Card Configuration ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġbe Ġcalling Ġall Ġob servers Ġonce Ġremote Ġcard Ġconfiguration Ġis Ġretrieved `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Config Observer Ġ= Ġmock < Card Configuration Observer >() ĊĠĠĠĠĠĠĠ Ġval Ġcard Configuration Client Ġ= Ġmock < Card Configuration Client >() ĊĠĠĠĠĠĠĠ Ġval ĠbaseUrl Ġ= Ġ" https :// localhost - mock : 8 4 4 3 " ĊĠĠĠĠĠĠĠ Ġval Ġcapt or Ġ= Ġargument Captor < Callback < Card Configuration >>() ĊĊĠĠĠĠĠĠĠ ĠCard Configuration Provider ( baseUrl , Ġcard Configuration Client , ĠlistOf ( card Config Observer )) ĊĊĠĠĠĠĠĠĠ Ġverify ( card Configuration Client ). get Card Configuration ( eq ( baseUrl ), Ġcapt or . capture ()) ĊĊĠĠĠĠĠĠĠ Ġcapt or . first Value . on Response ( null , ĠC ARD _ CONFIG _ BASIC ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ BASIC , ĠCard Configuration Provider . get Card Configuration ()) ĊĠĠĠĠĠĠĠ Ġverify ( card Config Observer ). update () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` should Ġdo Ġnothing Ġwhen Ġremote Ġcard Ġconfiguration Ġcall Ġfails `() Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġcard Config Observer Ġ= Ġmock < Card Configuration Observer >() ĊĠĠĠĠĠĠĠ Ġval Ġcard Configuration Client Ġ= Ġmock < Card Configuration Client >() ĊĠĠĠĠĠĠĠ Ġval ĠbaseUrl Ġ= Ġ" https :// localhost - mock : 8 4 4 3 " ĊĠĠĠĠĠĠĠ Ġval Ġcapt or Ġ= Ġargument Captor < Callback < Card Configuration >>() ĊĊĠĠĠĠĠĠĠ ĠCard Configuration Provider ( baseUrl , Ġcard Configuration Client , ĠlistOf ( card Config Observer )) ĊĊĠĠĠĠĠĠĠ Ġverify ( card Configuration Client ). get Card Configuration ( eq ( baseUrl ), Ġcapt or . capture ()) ĊĊĠĠĠĠĠĠĠ Ġcapt or . first Value . on Response ( IllegalArgumentException (), Ġnull ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( CARD _ CONFIG _ NO _ B RAND , ĠCard Configuration Provider . get Card Configuration ()) ĊĠĠĠĠĠĠĠ Ġverify ( card Config Observer , Ġnever ()). update () ĊĠĠĠ Ġ} Ċ } Ċ