package Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . pr ison . trans fers Ċ Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . assertj . core . api . Assertions . assertThat Thrown By Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . mockito . kotlin . any Ċ import Ġorg . mockito . kotlin . mock Ċ import Ġorg . mockito . kotlin . verify Ċ import Ġorg . mockito . kotlin . wh enever Ċ import Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . NotFoundException Ċ import Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . pr ison . Off ender Movement Ċ import Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . pr ison . Pr ison ApiClient Ċ import Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . pr ison . Transfer In Ċ import Ġuk . gov . just ice . digital . h mp ps . welcome to pr ison . model . pr ison . pr isoner search . Pr isoner Search Service Ċ import Ġjava . time . LocalDate Ċ import Ġjava . time . LocalDateTime Ċ import Ġjava . time . Local Time Ċ Ċ class ĠTrans fers Service Test Ġ{ ĊĠ Ġprivate Ġval Ġpr ison ApiClient : ĠPr ison ApiClient Ġ= Ġmock () ĊĠ Ġprivate Ġval Ġpr isoner Search Service : ĠPr isoner Search Service Ġ= Ġmock () ĊĠ Ġprivate Ġval Ġtransfers Service Ġ= ĠTrans fers Service ( pr ison ApiClient , Ġpr isoner Search Service ) ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` get Trans fers Ġ- Ġhappy Ġpath Ġif Ġpr isoner Ġhas Ġno ĠP NC ĠNumber `() Ġ{ ĊĠĠĠ Ġwhenever ( pr ison ApiClient . get Pr ison Trans fers En Route ( any ())). thenReturn ( listOf ( arrival Known To Nom is )) ĊĠĠĠ Ġwhenever ( pr isoner Search Service . getP nc Numbers ( any ())). thenReturn ( map Of (" G 6 0 8 1 VQ " Ġto Ġnull )) ĊĊĠĠĠ Ġval Ġtransfers Ġ= Ġtransfers Service . get Trans fers (" N MI ") ĊĊĠĠĠ ĠassertThat ( trans fers ). contains Exactly ( ĊĠĠĠĠĠ ĠTransfer ( ĊĠĠĠĠĠĠĠ Ġpr ison Number Ġ= Ġ" G 6 0 8 1 VQ ", ĊĠĠĠĠĠĠĠ Ġdate OfBirth Ġ= ĠLocalDate . of ( 1 9 8 1 , Ġ 7 , Ġ 4 ), ĊĠĠĠĠĠĠĠ ĠfirstName Ġ= Ġ" I run ce kas ", ĊĠĠĠĠĠĠĠ ĠlastName Ġ= Ġ" B ron ser ia ", ĊĠĠĠĠĠĠĠ Ġfrom Location Ġ= Ġ" Don caster Ġ( H MP )", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 1 1 , Ġ 9 , Ġ 8 ), ĊĠĠĠĠĠĠĠ Ġp nc Number Ġ= Ġnull , ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġverify ( pr ison ApiClient ). get Pr ison Trans fers En Route (" N MI ") ĊĠĠĠ Ġverify ( pr isoner Search Service ). getP nc Numbers ( listOf (" G 6 0 8 1 VQ ")) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` get Trans fers Ġ- Ġhappy Ġpath Ġif Ġpr isoner Ġhas ĠP NC ĠNumber `() Ġ{ ĊĠĠĠ Ġwhenever ( pr ison ApiClient . get Pr ison Trans fers En Route ( any ())). thenReturn ( listOf ( arrival Known To Nom is )) ĊĠĠĠ Ġwhenever ( pr isoner Search Service . getP nc Numbers ( any ())). thenReturn ( map Of (" G 6 0 8 1 VQ " Ġto Ġ" 1 2 / 3 9 4 7 7 3 H ")) ĊĊĠĠĠ Ġval Ġtransfers Ġ= Ġtransfers Service . get Trans fers (" N MI ") ĊĊĠĠĠ ĠassertThat ( trans fers ). contains Exactly ( ĊĠĠĠĠĠ ĠTransfer ( ĊĠĠĠĠĠĠĠ Ġpr ison Number Ġ= Ġ" G 6 0 8 1 VQ ", ĊĠĠĠĠĠĠĠ Ġdate OfBirth Ġ= ĠLocalDate . of ( 1 9 8 1 , Ġ 7 , Ġ 4 ), ĊĠĠĠĠĠĠĠ ĠfirstName Ġ= Ġ" I run ce kas ", ĊĠĠĠĠĠĠĠ ĠlastName Ġ= Ġ" B ron ser ia ", ĊĠĠĠĠĠĠĠ Ġfrom Location Ġ= Ġ" Don caster Ġ( H MP )", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 1 1 , Ġ 9 , Ġ 8 ), ĊĠĠĠĠĠĠĠ Ġp nc Number Ġ= Ġ" 1 2 / 3 9 4 7 7 3 H ", ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġverify ( pr ison ApiClient ). get Pr ison Trans fers En Route (" N MI ") ĊĠĠĠ Ġverify ( pr isoner Search Service ). getP nc Numbers ( listOf (" G 6 0 8 1 VQ ")) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġget Transfer () Ġ{ ĊĠĠĠ Ġwhenever ( pr ison ApiClient . get Pr ison Trans fers En Route ( any ())). thenReturn ( listOf ( arrival Known To Nom is )) ĊĊĠĠĠ Ġval Ġtransfers Ġ= Ġtransfers Service . get Transfer (" N MI ", Ġ" G 6 0 8 1 VQ ") ĊĊĠĠĠ ĠassertThat ( trans fers ). isEqualTo ( ĊĠĠĠĠĠ ĠTransfer ( ĊĠĠĠĠĠĠĠ Ġpr ison Number Ġ= Ġ" G 6 0 8 1 VQ ", ĊĠĠĠĠĠĠĠ Ġdate OfBirth Ġ= ĠLocalDate . of ( 1 9 8 1 , Ġ 7 , Ġ 4 ), ĊĠĠĠĠĠĠĠ ĠfirstName Ġ= Ġ" I run ce kas ", ĊĠĠĠĠĠĠĠ ĠlastName Ġ= Ġ" B ron ser ia ", ĊĠĠĠĠĠĠĠ Ġfrom Location Ġ= Ġ" Don caster Ġ( H MP )", ĊĠĠĠĠĠĠĠ Ġdate Ġ= ĠLocalDate . of ( 2 0 1 1 , Ġ 9 , Ġ 8 ), ĊĠĠĠĠĠĠĠ Ġp nc Number Ġ= Ġnull , ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġverify ( pr ison ApiClient ). get Pr ison Trans fers En Route (" N MI ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` get Transfer Ġfail Ġto Ġbe Ġfound `() Ġ{ ĊĠĠĠ Ġwhenever ( pr ison ApiClient . get Pr ison Trans fers En Route ( any ())). thenReturn ( listOf ( arrival Known To Nom is )) ĊĊĠĠĠ ĠassertThat Thrown By Ġ{ ĊĠĠĠĠĠ Ġtransfers Service . get Transfer (" N MI ", Ġ" A 1 2 3 4 AA ") ĊĠĠĠ Ġ}. isEqualTo ( NotFoundException (" Could Ġnot Ġfind Ġtransfer Ġwith Ġpr ison Number : Ġ' A 1 2 3 4 AA ' ")) ĊĠ Ġ} ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġar rival Known To Nom is Ġ= ĠOff ender Movement ( ĊĠĠĠĠĠ Ġoff ender No Ġ= Ġ" G 6 0 8 1 VQ ", ĊĠĠĠĠĠ Ġbooking Id Ġ= Ġ 4 7 2 1 9 5 , ĊĠĠĠĠĠ Ġdate OfBirth Ġ= ĠLocalDate . of ( 1 9 8 1 , Ġ 7 , Ġ 4 ), ĊĠĠĠĠĠ ĠfirstName Ġ= Ġ" IR UN CE K AS ", ĊĠĠĠĠĠ ĠlastName Ġ= Ġ" BR ON SER IA ", ĊĠĠĠĠĠ Ġfrom Ag ency Ġ= Ġ" D NI ", ĊĠĠĠĠĠ Ġfrom Ag ency Description Ġ= Ġ" Don caster Ġ( H MP )", ĊĠĠĠĠĠ Ġto Ag ency Ġ= Ġ" N MI ", ĊĠĠĠĠĠ Ġto Ag ency Description Ġ= Ġ" Not ting ham Ġ( H MP )", ĊĠĠĠĠĠ Ġmovement Type Ġ= Ġ" PR IS ON _ REM AND ", ĊĠĠĠĠĠ Ġmovement Type Description Ġ= Ġ" Trans fers ", ĊĠĠĠĠĠ Ġmovement Reason Ġ= Ġ" NOT R ", ĊĠĠĠĠĠ Ġmovement Reason Description Ġ= Ġ" Normal ĠTransfer ", ĊĠĠĠĠĠ Ġdirection Code Ġ= Ġ" OUT ", ĊĠĠĠĠĠ Ġmovement Time Ġ= ĠLocal Time . of ( 1 2 , Ġ 0 , Ġ 0 ), ĊĠĠĠĠĠ Ġmovement Date Ġ= ĠLocalDate . of ( 2 0 1 1 , Ġ 9 , Ġ 8 ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` transfer - in Ġoff ender `() Ġ{ ĊĊĠĠĠ Ġval Ġtransfer In Detail Ġ= ĠTransfer In Detail ( ĊĠĠĠĠĠ Ġcell Location Ġ= Ġ" M DI - RE CP ", ĊĠĠĠĠĠ Ġcomment Text Ġ= Ġ" some Ġtransfer Ġnotes ", ĊĠĠĠĠĠ Ġreceive Time Ġ= ĠLocalDateTime . now () ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġtransfer In Ġ= Ġwith ( transfer In Detail ) Ġ{ ĊĠĠĠĠĠ ĠTransfer In ( ĊĠĠĠĠĠĠĠ Ġcell Location , ĊĠĠĠĠĠĠĠ Ġcomment Text , ĊĠĠĠĠĠĠĠ Ġreceive Time ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġpr ison Number Ġ= Ġ" ABC 1 2 3 A " ĊĠĠĠ Ġtransfers Service . transfer In Off ender ( pr ison Number , Ġtransfer In Detail ) ĊĠĠĠ Ġverify ( pr ison ApiClient ). transfer In ( pr ison Number , Ġtransfer In ) ĊĠ Ġ} Ċ } Ċ