package Ġuk . gov . just ice . digital . h mp ps . where about s . services . vl bo ptions finder Ċ Ċ import Ġcom . microsoft . application insights . Telemetry Client Ċ import Ġio . mock k . Runs Ċ import Ġio . mock k . every Ċ import Ġio . mock k . just Ċ import Ġio . mock k . mock k Ċ import Ġio . mock k . verify Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . BeforeEach Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġuk . gov . just ice . digital . h mp ps . where about s . security . Authentication Facade Ċ import Ġjava . time . LocalDate Ċ import Ġjava . time . Local Time Ċ Ċ class ĠInstrument ed Video Link Booking Options Service Test Ġ{ ĊĠ Ġprivate Ġval Ġdelegate : ĠVideo Link Booking Options Service Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġauthentication Facade : ĠAuthentication Facade Ġ= Ġmock k () ĊĠ Ġprivate Ġval Ġtelemetry Client : ĠTe lemetry Client Ġ= Ġmock k () ĊĊĠ Ġprivate Ġval Ġservice Ġ= ĠInstrument ed Video Link Booking Options Service ( delegate , Ġauthentication Facade , Ġtelemetry Client ) ĊĊĠ Ġ@ BeforeEach ĊĠ Ġfun Ġinitialise Test () Ġ{ ĊĠĠĠ Ġevery Ġ{ Ġauthentication Facade . current Username Ġ} Ġreturns Ġ" user " ĊĠĠĠ Ġevery Ġ{ Ġtelemetry Client . track Event ( any (), Ġany (), Ġis Null ()) Ġ} Ġjust ĠRuns ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` Pre , Ġmain Ġand Ġpost Ġapp ointments , Ġnot Ġmatched , Ġone Ġalternative `() Ġ{ ĊĊĠĠĠ Ġval Ġexpected Result Ġ= ĠVideo Link Booking Options ( ĊĠĠĠĠĠ Ġmatched Ġ= Ġfalse , ĊĠĠĠĠĠ Ġalternatives Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ ĠVideo Link Booking Option ( ĊĠĠĠĠĠĠĠĠĠ Ġpre Ġ= ĠLocation And Interval ( 1 L , ĠInterval ( Local Time . of ( 1 2 , Ġ 0 ), ĠLocal Time . of ( 1 2 , Ġ 3 0 ))), ĊĠĠĠĠĠĠĠĠĠ Ġmain Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 2 , Ġ 3 0 ), ĠLocal Time . of ( 1 3 , Ġ 0 ))), ĊĠĠĠĠĠĠĠĠĠ Ġpost Ġ= ĠLocation And Interval ( 3 L , ĠInterval ( Local Time . of ( 1 3 , Ġ 0 ), ĠLocal Time . of ( 1 3 , Ġ 3 0 ))) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġdelegate . find Video Link Booking Options ( any ()) Ġ} Ġreturns Ġexpected Result ĊĊĠĠĠ Ġval Ġresult Ġ= Ġservice . find Video Link Booking Options ( ĊĠĠĠĠĠ ĠVideo Link Booking Search Specification ( ĊĠĠĠĠĠĠĠ Ġagency Id Ġ= Ġ" W WI ", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 2 0 , Ġ 6 , Ġ 1 ), ĊĠĠĠĠĠĠĠ Ġpre Appointment Ġ= ĠLocation And Interval ( 1 L , ĠInterval ( Local Time . of ( 9 , Ġ 3 0 ), ĠLocal Time . of ( 1 0 , Ġ 0 ))), ĊĠĠĠĠĠĠĠ Ġmain Appointment Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 0 , Ġ 0 ), ĠLocal Time . of ( 1 0 , Ġ 3 0 ))), ĊĠĠĠĠĠĠĠ Ġpost Appointment Ġ= ĠLocation And Interval ( 3 L , ĠInterval ( Local Time . of ( 1 0 , Ġ 3 0 ), ĠLocal Time . of ( 1 1 , Ġ 0 ))), ĊĠĠĠĠĠĠĠ Ġv lb Id To Exclude Ġ= Ġ 1 0 L ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( result ). isEqualTo ( expected Result ) ĊĊĠĠĠ Ġverify Ġ{ ĊĠĠĠĠĠ Ġtelemetry Client . track Event ( ĊĠĠĠĠĠĠĠ Ġ" find Video Link Booking Options ", ĊĠĠĠĠĠĠĠ Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" user " Ġto Ġ" user ", ĊĠĠĠĠĠĠĠĠĠ Ġ" agency Id " Ġto Ġ" W WI ", ĊĠĠĠĠĠĠĠĠĠ Ġ" date " Ġto Ġ" 2 0 2 0 - 0 6 - 0 1 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" v lb To Exclude " Ġto Ġ" 1 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" matched " Ġto Ġ" false ", ĊĠĠĠĠĠĠĠĠĠ Ġ" altern atives Count " Ġto Ġ" 1 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" alternative Main Start Times " Ġto Ġ" 1 2 : 3 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" pre Location Id " Ġto Ġ" 1 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" pre Start " Ġto Ġ" 0 9 : 3 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" pre End " Ġto Ġ" 1 0 : 0 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Location Id " Ġto Ġ" 2 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Start " Ġto Ġ" 1 0 : 0 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main End " Ġto Ġ" 1 0 : 3 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" post Location Id " Ġto Ġ" 3 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" post Start " Ġto Ġ" 1 0 : 3 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" post End " Ġto Ġ" 1 1 : 0 0 " ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` Main Ġappointment Ġonly , Ġmatched `() Ġ{ ĊĊĠĠĠ Ġval Ġexpected Result Ġ= ĠVideo Link Booking Options ( matched Ġ= Ġtrue , Ġalternatives Ġ= ĠlistOf ()) ĊĊĠĠĠ Ġevery Ġ{ Ġdelegate . find Video Link Booking Options ( any ()) Ġ} Ġreturns Ġexpected Result ĊĊĠĠĠ Ġval Ġresult Ġ= Ġservice . find Video Link Booking Options ( ĊĠĠĠĠĠ ĠVideo Link Booking Search Specification ( ĊĠĠĠĠĠĠĠ Ġagency Id Ġ= Ġ" W WI ", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 2 0 , Ġ 6 , Ġ 1 ), ĊĠĠĠĠĠĠĠ Ġmain Appointment Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 0 , Ġ 0 ), ĠLocal Time . of ( 1 0 , Ġ 3 0 ))), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( result ). isEqualTo ( expected Result ) ĊĊĠĠĠ Ġverify Ġ{ ĊĠĠĠĠĠ Ġtelemetry Client . track Event ( ĊĠĠĠĠĠĠĠ Ġ" find Video Link Booking Options ", ĊĠĠĠĠĠĠĠ Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" user " Ġto Ġ" user ", ĊĠĠĠĠĠĠĠĠĠ Ġ" agency Id " Ġto Ġ" W WI ", ĊĠĠĠĠĠĠĠĠĠ Ġ" date " Ġto Ġ" 2 0 2 0 - 0 6 - 0 1 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" v lb To Exclude " Ġto Ġ"", ĊĠĠĠĠĠĠĠĠĠ Ġ" matched " Ġto Ġ" true ", ĊĠĠĠĠĠĠĠĠĠ Ġ" altern atives Count " Ġto Ġ" 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" alternative Main Start Times " Ġto Ġ"", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Location Id " Ġto Ġ" 2 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Start " Ġto Ġ" 1 0 : 0 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main End " Ġto Ġ" 1 0 : 3 0 ", ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` Main Ġappointment Ġonly , Ġnot Ġmatched , Ġ 2 Ġalternatives `() Ġ{ ĊĊĠĠĠ Ġval Ġexpected Result Ġ= ĠVideo Link Booking Options ( ĊĠĠĠĠĠ Ġmatched Ġ= Ġfalse , ĊĠĠĠĠĠ Ġalternatives Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠ ĠVideo Link Booking Option ( main Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 2 , Ġ 3 0 ), ĠLocal Time . of ( 1 3 , Ġ 0 )))), ĊĠĠĠĠĠĠĠ ĠVideo Link Booking Option ( main Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 3 , Ġ 3 0 ), ĠLocal Time . of ( 1 4 , Ġ 0 )))) ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġevery Ġ{ Ġdelegate . find Video Link Booking Options ( any ()) Ġ} Ġreturns Ġexpected Result ĊĊĠĠĠ Ġval Ġresult Ġ= Ġservice . find Video Link Booking Options ( ĊĠĠĠĠĠ ĠVideo Link Booking Search Specification ( ĊĠĠĠĠĠĠĠ Ġagency Id Ġ= Ġ" W WI ", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 2 0 , Ġ 6 , Ġ 1 ), ĊĠĠĠĠĠĠĠ Ġmain Appointment Ġ= ĠLocation And Interval ( 2 L , ĠInterval ( Local Time . of ( 1 0 , Ġ 0 ), ĠLocal Time . of ( 1 0 , Ġ 3 0 ))), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ ĠassertThat ( result ). isEqualTo ( expected Result ) ĊĊĠĠĠ Ġverify Ġ{ ĊĠĠĠĠĠ Ġtelemetry Client . track Event ( ĊĠĠĠĠĠĠĠ Ġ" find Video Link Booking Options ", ĊĠĠĠĠĠĠĠ Ġmutable Map Of ( ĊĠĠĠĠĠĠĠĠĠ Ġ" user " Ġto Ġ" user ", ĊĠĠĠĠĠĠĠĠĠ Ġ" agency Id " Ġto Ġ" W WI ", ĊĠĠĠĠĠĠĠĠĠ Ġ" date " Ġto Ġ" 2 0 2 0 - 0 6 - 0 1 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" v lb To Exclude " Ġto Ġ"", ĊĠĠĠĠĠĠĠĠĠ Ġ" matched " Ġto Ġ" false ", ĊĠĠĠĠĠĠĠĠĠ Ġ" altern atives Count " Ġto Ġ" 2 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" alternative Main Start Times " Ġto Ġ" 1 2 : 3 0 , 1 3 : 3 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Location Id " Ġto Ġ" 2 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main Start " Ġto Ġ" 1 0 : 0 0 ", ĊĠĠĠĠĠĠĠĠĠ Ġ" main End " Ġto Ġ" 1 0 : 3 0 ", ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ