package Ġuk . gov . just ice . digital . h mp ps . pec s . j pc . domain . move Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . boot . test . autoconfigure . orm . jpa . Data Jpa Test Ċ import Ġorg . springframework . boot . test . autoconfigure . orm . jpa . Test EntityManager Ċ import Ġorg . springframework . test . context . Active Profiles Ċ import Ġuk . gov . just ice . digital . h mp ps . pec s . j pc . domain . price . Supplier Ċ import Ġjava . time . LocalDate Ċ import Ġjava . util . UUID Ċ Ċ @ Active Profiles (" test ") Ċ @ Data Jpa Test Ċ internal Ġclass ĠMove Repository Test Ġ{ ĊĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġmove Repository : ĠMove Repository ĊĊĠ Ġ@ Autowired ĊĠ Ġlateinit Ġvar Ġentity Manager : ĠTest EntityManager ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` save Ġreport Ġmodel `() Ġ{ ĊĠĠĠ Ġval Ġmove Ġ= Ġmove M 1 (). copy ( notes Ġ= Ġ" a ". repeat ( 1 0 2 4 )) ĊĠĠĠ Ġval Ġjourney Model Ġ= ĊĠĠĠĠĠ Ġjourney J 1 ( move Id Ġ= Ġmove . move Id , Ġevents Ġ= ĠlistOf ( event E 1 ( eventId Ġ= Ġ" E 1 ", Ġevent able Id Ġ= Ġjourney J 1 (). jo urney Id ))) ĊĠĠĠ Ġval Ġmove Model Ġ= Ġmove . copy ( ĊĠĠĠĠĠ Ġevents Ġ= ĠlistOf ( event E 1 ( eventId Ġ= Ġ" E 2 ", Ġevent able Id Ġ= Ġmove . move Id )), ĊĠĠĠĠĠ Ġjourney s Ġ= ĠlistOf ( jo urney Model ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġpersisted Report Ġ= Ġmove Repository . save ( move Model ) ĊĊĠĠĠ Ġentity Manager . flush () ĊĠĠĠ Ġentity Manager . clear () ĊĊĠĠĠ Ġval Ġretrieved Move Ġ= Ġmove Repository . findById ( pers isted Report . move Id ). get () ĊĊĠĠĠ ĠassertThat ( retrie ved Move ). isEqualTo ( move Model ) ĊĠĠĠ ĠassertThat ( retrie ved Move . notes ). contains (" a ". repeat ( 1 0 2 4 )) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` find Ġexactly Ġtwo Ġordered Ġre conc il able Ġmoves Ġfor ĠSer co `() Ġ{ ĊĠĠĠ ĠassertThat ( move Repository . find Completed Candidate Re conc il able Moves ( Supplier . SER CO , Ġ 2 0 2 2 , Ġ 5 )). isEmpty () ĊĊĠĠĠ Ġval Ġser co Move Missing Drop Off Ġ= Ġmove M 1 (). copy ( ĊĠĠĠĠĠ Ġmove Id Ġ= ĠUUID . randomUUID (). toString (), ĊĠĠĠĠĠ Ġmove Date Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ), ĊĠĠĠĠĠ Ġmove Type Ġ= ĠMove Type . STANDARD , ĊĠĠĠĠĠ Ġsupplier Ġ= ĠSupplier . SER CO , ĊĠĠĠĠĠ Ġpick Up DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 2 ). at Start OfDay (), ĊĠĠĠĠĠ Ġdrop Off Or Cancelled DateTime Ġ= Ġnull ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġser co Move Missing Move Type Ġ= Ġmove M 1 (). copy ( ĊĠĠĠĠĠ Ġmove Id Ġ= ĠUUID . randomUUID (). toString (), ĊĠĠĠĠĠ Ġmove Date Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ), ĊĠĠĠĠĠ Ġmove Type Ġ= Ġnull , ĊĠĠĠĠĠ Ġpick Up DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay (), ĊĠĠĠĠĠ Ġdrop Off Or Cancelled DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġser co Move Move Type And Drop Off Present Ġ= Ġmove M 1 (). copy ( ĊĠĠĠĠĠ Ġmove Id Ġ= ĠUUID . randomUUID (). toString (), ĊĠĠĠĠĠ Ġmove Date Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ), ĊĠĠĠĠĠ Ġmove Type Ġ= ĠMove Type . STANDARD , ĊĠĠĠĠĠ Ġpick Up DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay (), ĊĠĠĠĠĠ Ġdrop Off Or Cancelled DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġgeo Move Missing Drop Off Ġ= Ġser co Move Missing Drop Off . copy ( ĊĠĠĠĠĠ Ġmove Id Ġ= ĠUUID . randomUUID (). toString (), ĊĠĠĠĠĠ Ġsupplier Ġ= ĠSupplier . GEO AME Y , ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġgeo Move Missing Move Type Ġ= Ġser co Move Missing Move Type . copy ( ĊĠĠĠĠĠ Ġmove Id Ġ= ĠUUID . randomUUID (). toString (), ĊĠĠĠĠĠ Ġsupplier Ġ= ĠSupplier . GEO AME Y , ĊĠĠĠĠĠ Ġmove Date Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ), ĊĠĠĠĠĠ Ġmove Type Ġ= Ġnull , ĊĠĠĠĠĠ Ġpick Up DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay (), ĊĠĠĠĠĠ Ġdrop Off Or Cancelled DateTime Ġ= ĠLocalDate . of ( 2 0 2 2 , Ġ 5 , Ġ 1 ). at Start OfDay () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġmove Repository . save All And Flush ( ĊĠĠĠĠĠ ĠlistOf ( ĊĠĠĠĠĠĠĠ Ġser co Move Missing Drop Off , ĊĠĠĠĠĠĠĠ Ġser co Move Missing Move Type , ĊĠĠĠĠĠĠĠ Ġser co Move Move Type And Drop Off Present , ĊĠĠĠĠĠĠĠ Ġgeo Move Missing Drop Off , ĊĠĠĠĠĠĠĠ Ġgeo Move Missing Move Type , ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġresults Ġ= Ġmove Repository . find Completed Candidate Re conc il able Moves ( Supplier . SER CO , Ġ 2 0 2 2 , Ġ 5 ) ĊĊĠĠĠ ĠassertThat ( results ). contains Exactly ( ser co Move Missing Move Type , Ġser co Move Missing Drop Off ) ĊĠ Ġ} Ċ } Ċ