package Ġdev . number 6 . slack reader . core Ċ Ċ import Ġassert k . assertThat Ċ import Ġassert k . assertions . contains None Ċ import Ġassert k . assertions . contains Only Ċ import Ġcom . amazonaws . services . lambda . runtime . Lambda Logger Ċ import Ġdev . number 6 . slack reader . Slack Service Ċ import Ġdev . number 6 . slack reader . generate . Slack Reader RD G Ċ import Ġdev . number 6 . slack . model . Channel Ċ import Ġdev . number 6 . slack . model . Message Ċ import Ġdev . number 6 . slack reader . port . Slack Reader Port Ċ import Ġdev . number 6 . slack reader . port . Slack Reader Configuration Port Ċ import Ġio . mock k . every Ċ import Ġio . mock k . junit 5 . Mock K Extension Ċ import Ġio . mock k . mock k Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . junit . jupiter . api . extension . Extend With Ċ import Ġuk . org . fy od or . generators . Generator Ċ import Ġuk . org . fy od or . generators . RD G Ċ import Ġuk . org . fy od or . range . Range Ċ import Ġjava . time . LocalDate Ċ Ċ @ Extend With ( Mock K Extension :: class ) Ċ internal Ġclass ĠSlack Service Test Ġ{ ĊĠĠĠ Ġprivate Ġval Ġlogger : ĠLambda Logger Ġ= Ġmock k ( relax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠ Ġprivate Ġval Ġslack Reader Port : ĠSlack Reader Port Ġ= Ġmock k ( relax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠ Ġprivate Ġval Ġconfig : ĠSlack Reader Configuration Port Ġ= Ġmock k ( relax Unit Fun Ġ= Ġtrue ) ĊĊĠĠĠ Ġprivate Ġval Ġchannels Generator Ġ= ĠSlack Reader RD G . channels ( Range . closed ( 5 , Ġ 2 0 )) ĊĠĠĠ Ġprivate Ġval Ġmessages Generator : ĠGenerator < List < Message >> Ġ= ĠR DG . list ( Slack Reader RD G . message (), ĠRange . closed ( 5 , Ġ 5 0 )) ĊĠĠĠ Ġprivate Ġval Ġtest ee : ĠSlack Service Ġ= ĠSlack Service ( slack Reader Port , Ġconfig ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġget Messages On Date () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġconfig . get Black listed Channels () Ġ} Ġreturns ĠlistOf () ĊĠĠĠĠĠĠĠ Ġval Ġchannels Ġ= Ġchannels Generator . next () ĊĠĠĠĠĠĠĠ Ġval Ġexpected Messages Ġ= Ġchannels . associate By ({ Ġc Ġ-> Ġc . name Ġ}, Ġ{ Ġmessages Generator . next () Ġ}) ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġslack Reader Port . getChannel List ( logger ) Ġ} Ġreturns Ġchannels ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġslack Reader Port . get Messages For Channel On Date ( any (), Ġany (), Ġany ()) Ġ} Ġanswers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġexpected Messages [ first Arg < Channel >(). name ] Ġ?: ĠlistOf () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġmessages Ġ= Ġtest ee . get Messages On Date ( LocalDate . now (), Ġlogger ) ĊĠĠĠĠĠĠĠ Ġval Ġchannel Names Ġ= Ġchannels . map Ġ{ Ġc Ġ-> Ġc . name Ġ} ĊĠĠĠĠĠĠĠ ĠassertThat ( messages . getActive Channel Names ()). contains Only (* channel Names . to Typed Array ()) ĊĊĠĠĠĠĠĠĠ Ġmessages . getActive Channel Names (). forEach Ġ{ Ġname Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( messages . get Messages For Channel ( name )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains Only (* expected Messages [ name ]?. map Ġ{ Ġm Ġ-> Ġm . text Ġ} ?. to Typed Array () Ġ?: ĠArray ( 0 ) Ġ{ Ġ"" Ġ}) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġignore Messages For Black listed Channels () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġchannel 1 Name Ġ= Ġ" channel Ġ 1 Ġname " ĊĠĠĠĠĠĠĠ Ġval Ġchannel 2 Name Ġ= Ġ" channel Ġ 2 Ġname " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġconfig . get Black listed Channels () Ġ} Ġreturns ĠlistOf ( channel 1 Name , Ġchannel 2 Name ) ĊĠĠĠĠĠĠĠ Ġval Ġchannels Ġ= Ġchannels Generator . next () ĊĠĠĠĠĠĠĠ Ġchannels . add ( Channel (" wh atever ", Ġchannel 1 Name )) ĊĠĠĠĠĠĠĠ Ġchannels . add ( Channel (" wh atever 2 ", Ġchannel 2 Name )) ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġslack Reader Port . getChannel List ( logger ) Ġ} Ġreturns Ġchannels ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġslack Reader Port . get Messages For Channel On Date ( any (), Ġany (), Ġany ()) Ġ} Ġreturns Ġmessages Generator . next () ĊĠĠĠĠĠĠĠ Ġval Ġmessages Ġ= Ġtest ee . get Messages On Date ( LocalDate . now (), Ġlogger ) ĊĠĠĠĠĠĠĠ ĠassertThat ( messages . getActive Channel Names ()). contains None ( channel 1 Name , Ġchannel 2 Name ) ĊĠĠĠ Ġ} Ċ }