package Ġru . ot us . ot us kotlin . reminder calendar . repository . sql . events Ċ Ċ import Ġkotlinx . coroutines . run Blocking Ċ import Ġorg . assertj . core . api . Assertions Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġru . ot us . ot us kotlin . reminder calendar . common . backend . context . Context Ċ import Ġru . ot us . ot us kotlin . reminder calendar . common . backend . model . Event Model Ċ import Ġru . ot us . ot us kotlin . reminder calendar . common . backend . model . Frequency Model Ċ import Ġru . ot us . ot us kotlin . reminder calendar . common . backend . model . UserId Ċ import Ġjava . time . LocalDateTime Ċ import Ġkotlin . time . Duration Unit Ċ import Ġkotlin . time . Experimental Time Ċ import Ġkotlin . time . to Duration Ċ Ċ internal Ġclass ĠEvent Repository InMemory Test Ġ{ ĊĠĠĠ Ġ@ Opt In ( Experimental Time :: class ) ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcreate AndGet Test () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġrepository Ġ= ĠEvent Repository InMemory ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġttl Ġ= Ġ 5 . to Duration ( Duration Unit . MIN UTES ) ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġevent Ġ= ĠEvent Model ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdescription Ġ= Ġ" test - description ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname Ġ= Ġ" name ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstart Schedule Ġ= ĠLocalDateTime . of ( 2 0 2 0 , Ġ 2 , Ġ 2 5 , Ġ 7 , Ġ 2 2 ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfrequency Ġ= ĠFrequency Model . DA IL Y , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠuserId Ġ= ĠUserId (" test - user - id "), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmobile Ġ= Ġ" test - mobile ", ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= ĠContext ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequest Event Ġ= Ġevent ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġrun Blocking Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcreated Event Ġ= Ġrepository . create ( context ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAssertions . assertThat ( created Event ). isEqualTo Ign oring Given Fields ( event , Ġ" id ") ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext . request EventId Ġ= Ġcreated Event . id ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġread Event Ġ= Ġrepository . read ( context ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAssertions . assertThat ( read Event ). isEqualTo Comp aring Field By Field ( created Event ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }