package Ġcom . k re ait . bots . agile . domain . slack . stand up Definition . leave Ċ Ċ // TODO Ġshould Ġthis Ġpackage Ġbe Ġlocated Ġin Ġthe Ġslack Ġpackage Ġor Ġhere Ġin Ġstand up Definition ? ĊĊ Ċ import Ġcom . k re ait . bots . agile . UnitTest Ċ import Ġcom . k re ait . bots . agile . core . stand up . data . repository . sample Ċ import Ġcom . k re ait . bots . agile . core . stand up definition . sample Ċ import Ġcom . k re ait . bots . agile . domain . common . data . Stand up Ċ import Ġcom . k re ait . bots . agile . domain . common . data . Stand up Definition Ċ import Ġcom . k re ait . bots . agile . domain . common . data . Stand up Definition Repository Ċ import Ġcom . k re ait . bots . agile . domain . common . data . Stand up Repository Ċ import Ġcom . k re ait . bots . agile . domain . slack . Slack Event Test Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . any Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . do Return Ċ 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 . times Ċ import Ġcom . n ha ar man . mock it ok otlin 2 . verify Ċ import Ġcom . k re ait . slack . api . contract . jackson . event . Slack Event Ċ import Ġcom . k re ait . slack . api . contract . jackson . event . sample Ċ import Ġorg . junit . jupiter . api . Assertions Ċ import Ġorg . junit . jupiter . api . DisplayName Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . data . mongodb . core . query . Update Ċ import Ġorg . springframework . http . HttpHeaders Ċ Ċ @ UnitTest Ċ class ĠMember Left Event Receiver Test Ġ: ĠSlack Event Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" Test ĠSupports Ġleave ĠEvent ") ĊĠĠĠ Ġoverride Ġfun Ġsupports Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġservice Ġ= Ġmock < Member Left Message Sender > Ġ{} ĊĠĠĠĠĠĠĠ Ġval Ġreceiver Ġ= ĠMember Left Event Receiver ( mock Ġ{ Ġ}, Ġmock Ġ{ Ġ}, Ġservice ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertTrue ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreceiver . supports Event ( Slack Event . sample (). copy ( event Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" type ", Ġ" member _ left _ channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" user ", Ġ" test User "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" channel ", Ġ" test Channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" team ", Ġ" test Team ")) )) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠAssertions . assertFalse ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreceiver . supports Event ( Slack Event . sample (). copy ( event Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" type ", Ġ" member _ left _ channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" bot _ user ", Ġ" bot "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" channel ", Ġ" test Channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" team ", Ġ" test Team ")) ))) ĊĠĠĠĠĠĠĠ ĠAssertions . assertFalse ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreceiver . supports Event ( Slack Event . sample (). copy ( event Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" type ", Ġ" member _ joined _ channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" user ", Ġ" test User "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" channel ", Ġ" test Channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" team ", Ġ" test Team ")) ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" Test Ġreceive ĠEvent ") ĊĠĠĠ Ġoverride Ġfun Ġon Receive Event () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmessage Sender Ġ= Ġmock < Member Left Message Sender > Ġ{} ĊĊĊĠĠĠĠĠĠĠ Ġval Ġsample Stand up Def Ġ= ĠStand up Definition . sample (). copy ( id Ġ= Ġ" Sample Def Id ") ĊĠĠĠĠĠĠĠ Ġval Ġstand up Definition Repository Ġ= Ġmock < Stand up Definition Repository > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġfind ( any (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany ()) Ġ} Ġdo Return ĠlistOf ( sample Stand up Def ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĊĠĠĠĠĠĠĠ Ġval Ġstand up Repository Ġ= Ġmock < Stand up Repository > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġon Ġ{ Ġfind ( any (), Ġeq (" Sample Def Id "), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany ()) Ġ} Ġdo Return ĠlistOf ( Stand up . sample (). copy ( status Ġ= ĠStand up . Status . OPEN )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreceiver Ġ= ĠMember Left Event Receiver ( stand up Definition Repository , Ġstand up Repository , Ġmessage Sender ) ĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠSlack Event . sample (). copy ( event Ġ= Ġmap Of ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" type ", Ġ" member _ left _ channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" user ", Ġ" test User "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" channel ", Ġ" test Channel "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPair (" team ", Ġ" test Team "))) ĊĠĠĠĠĠĠĠ Ġreceiver . on Receive Event ( slack Event Ġ= Ġevent , Ġheaders Ġ= ĠHttp Headers . EMPTY , Ġteam Ġ= Ġcom . k re ait . slack . broker . store . team . Team (" test Team ", Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcom . k re ait . slack . broker . store . team . Team . Bot ("", Ġ" "))) ĊĊĠĠĠĠĠĠĠ Ġverify ( message Sender , Ġtimes ( 0 )). send Cancel Open Stand up Message ( event . event [" user "]. toString (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠStand up Definition . sample (), Ġ"") ĊĊĠĠĠĠĠĠĠ Ġverify ( stand up Repository , Ġtimes ( 1 )). update ( any (), Ġeq (" Sample Def Id "), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġany (), Ġeq ( Update . update ( Stand up . STATUS , ĠStand up . Status . CLOSED ))) ĊĊĠĠĠĠĠĠĠ Ġverify ( message Sender , Ġtimes ( 1 )). send Channel Left Message ( event . event [" user "]. toString (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠlistOf ( sample Stand up Def ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġevent . event [" channel "]. toString (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"") ĊĊĊĠĠĠ Ġ} Ċ } Ċ