Skip to content

Commit cb5ccea

Browse files
committedMay 8, 2024
Adding data to test response
1 parent 002482b commit cb5ccea

File tree

1 file changed

+49
-24
lines changed

1 file changed

+49
-24
lines changed
 

‎src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/controllers/v1/person/PersonControllerTest.kt

+49-24
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,19 @@ internal class PersonControllerTest(
222222
}
223223

224224
describe("GET $basePath/{id}") {
225-
val person = Person("Silly", "Sobbers")
225+
val probationOffenderSearch = Person("Sam", "Smith", identifiers = Identifiers(nomisNumber = "1234ABC"))
226+
val prisonOffenderSearch = POSPrisoner("Kim", "Kardashian")
227+
val prisonResponse = Response(data = prisonOffenderSearch, errors = emptyList())
226228

227229
beforeTest {
228230
Mockito.reset(getPersonService)
229231
Mockito.reset(auditService)
230232

231-
val personMap = mapOf("probationOffenderSearch" to person, "prisonerOffenderSearch" to null)
233+
val personMap =
234+
mapOf(
235+
"probationOffenderSearch" to probationOffenderSearch,
236+
"prisonerOffenderSearch" to prisonResponse.data.toPerson(),
237+
)
232238
whenever(getPersonService.getCombinedDataForPerson(hmppsId)).thenReturn(Response(data = personMap))
233239
}
234240

@@ -309,29 +315,48 @@ internal class PersonControllerTest(
309315

310316
result.response.contentAsString.shouldBe(
311317
"""
312-
{
313-
"data": {
314-
"probationOffenderSearch": {
315-
"firstName": "Silly",
316-
"lastName": "Sobbers",
317-
"middleName": null,
318-
"dateOfBirth": null,
319-
"gender": null,
320-
"ethnicity": null,
321-
"aliases": [],
322-
"identifiers": {
323-
"nomisNumber": null,
324-
"croNumber": null,
325-
"deliusCrn": null
326-
},
327-
"pncId": null,
328-
"hmppsId": null,
329-
"contactDetails": null
330-
},
331-
"prisonerOffenderSearch": null
318+
{
319+
"data":{
320+
"probationOffenderSearch":{
321+
"firstName":"Sam",
322+
"lastName":"Smith",
323+
"middleName":null,
324+
"dateOfBirth":null,
325+
"gender":null,
326+
"ethnicity":null,
327+
"aliases":[
328+
329+
],
330+
"identifiers":{
331+
"nomisNumber":"1234ABC",
332+
"croNumber":null,
333+
"deliusCrn":null
334+
},
335+
"pncId":null,
336+
"hmppsId":null,
337+
"contactDetails":null
338+
},
339+
"prisonerOffenderSearch":{
340+
"firstName":"Kim",
341+
"lastName":"Kardashian",
342+
"middleName":null,
343+
"dateOfBirth":null,
344+
"gender":null,
345+
"ethnicity":null,
346+
"aliases":[
347+
348+
],
349+
"identifiers":{
350+
"nomisNumber":null,
351+
"croNumber":null,
352+
"deliusCrn":null
353+
},
354+
"pncId":null,
355+
"hmppsId":null,
356+
"contactDetails":null
357+
}
358+
}
332359
}
333-
}
334-
335360
""".removeWhitespaceAndNewlines(),
336361
)
337362
}

0 commit comments

Comments
 (0)