package Ġuk . gov . just ice . digital . h mp ps . send legal mailto pr is ons api . mocks Ċ Ċ import Ġcom . github . tom ake hur st . wire mock . Wire Mock Server Ċ import Ġcom . github . tom ake hur st . wire mock . client . Verification Exception Ċ import Ġcom . github . tom ake hur st . wire mock . client . Wire Mock Ċ import Ġcom . github . tom ake hur st . wire mock . client . Wire Mock . a Response Ċ import Ġcom . github . tom ake hur st . wire mock . client . Wire Mock . post Ċ import Ġcom . github . tom ake hur st . wire mock . client . Wire Mock . post Requested For Ċ import Ġcom . github . tom ake hur st . wire mock . common . Single Root File Source Ċ import Ġcom . github . tom ake hur st . wire mock . core . Wire Mock Configuration Ċ import Ġorg . junit . jupiter . api . extension . After All Callback Ċ import Ġorg . junit . jupiter . api . extension . Before All Callback Ċ import Ġorg . junit . jupiter . api . extension . BeforeEach Callback Ċ import Ġorg . junit . jupiter . api . extension . Extension Context Ċ Ċ class ĠPr isoner Search Extension Ġ: ĠBefore All Callback , ĠAfter All Callback , ĠBefore Each Callback Ġ{ ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġval Ġpr isoner Search Api Ġ= ĠPr isoner Search Mock Server () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġbefore All ( context : ĠExtension Context ) Ġ{ ĊĠĠĠ Ġpr isoner Search Api . start () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠbeforeEach ( context : ĠExtension Context ) Ġ{ ĊĠĠĠ Ġpr isoner Search Api . reset Requests () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġafter All ( context : ĠExtension Context ) Ġ{ ĊĠĠĠ Ġpr isoner Search Api . stop () ĊĠ Ġ} Ċ } Ċ Ċ class ĠPr isoner Search Mock Server Ġ: ĠWire Mock Server ( WI RE MOCK _ CONFIG ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġprivate Ġconst Ġval ĠW I RE MOCK _ PORT Ġ= Ġ 8 0 9 1 ĊĠĠĠ Ġprivate Ġval ĠW I RE MOCK _ CONFIG Ġ= ĠWire Mock Configuration . wire Mock Config () ĊĠĠĠĠĠ Ġ. port ( WI RE MOCK _ PORT ) ĊĠĠĠĠĠ Ġ. file Source ( Single Root File Source (" src / test Integration / resources ")) ĊĠ Ġ} ĊĊĠ Ġfun Ġstub Match Pr ison ers () Ġ{ ĊĠĠĠ Ġstub For ( ĊĠĠĠĠĠ Ġpost ( Wire Mock . url EqualTo ("/ match - pr ison ers ")) ĊĠĠĠĠĠĠĠ Ġ. willReturn ( ĊĠĠĠĠĠĠĠĠĠ Ġa Response () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Header (" Content - Type ", Ġ" application / json ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Body File (" pr isoner - search / match - pr ison ers - response . json ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġfun Ġstub Global Search () Ġ{ ĊĠĠĠ Ġstub For ( ĊĠĠĠĠĠ Ġpost ( Wire Mock . url EqualTo ("/ global - search ")) ĊĠĠĠĠĠĠĠ Ġ. willReturn ( ĊĠĠĠĠĠĠĠĠĠ Ġa Response () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Header (" Content - Type ", Ġ" application / json ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. with Body File (" pr isoner - search / global - search - response . json ") ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġfun Ġmatch Pr ison ers HasBeen Called (): ĠBoolean Ġ= ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġverify ( post Requested For ( Wire Mock . url EqualTo ("/ match - pr ison ers "))) ĊĠĠĠĠĠ Ġtrue ĊĠĠĠ Ġ} Ġcatch Ġ( verification Exception : ĠVerification Exception ) Ġ{ ĊĠĠĠĠĠ Ġfalse ĊĠĠĠ Ġ} ĊĊĠ Ġfun Ġglobal Search HasBeen Called (): ĠBoolean Ġ= ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġverify ( post Requested For ( Wire Mock . url EqualTo ("/ global - search "))) ĊĠĠĠĠĠ Ġtrue ĊĠĠĠ Ġ} Ġcatch Ġ( verification Exception : ĠVerification Exception ) Ġ{ ĊĠĠĠĠĠ Ġfalse ĊĠĠĠ Ġ} Ċ } Ċ