@@ -18,6 +18,7 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.gateways.ProbationOffend
18
18
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Identifiers
19
19
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.OffenderSearchResponse
20
20
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Person
21
+ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.PersonInPrison
21
22
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.PersonOnProbation
22
23
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
23
24
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.UpstreamApi
@@ -141,14 +142,14 @@ internal class GetPersonServiceTest(
141
142
142
143
it("returns a prisoner when valid hmppsId is provided") {
143
144
val validHmppsId = " G2996UX"
144
- val person = Person (firstName = "Sam ", lastName = "Mills ")
145
+ val person = PersonInPrison ( Person (firstName = "Sam ", lastName = "Mills "), category = null, crsa = null, dateOfReception = null, status = null, prisonId = null, prisonName = null, cellLocation = null )
145
146
whenever(prisonerOffenderSearchGateway.getPrisonOffender(nomsNumber = "G2996UX ")).thenReturn(
146
147
Response (data = POSPrisoner (firstName = "Sam ", lastName = "Mills ")),
147
148
)
148
149
149
150
val result = getPersonService.getPrisoner(validHmppsId, blankConsumerFilters)
150
151
151
- result.data.shouldBeTypeOf<Person >()
152
+ result.data.shouldBeTypeOf<PersonInPrison >()
152
153
result.data!!.firstName.shouldBe(person.firstName)
153
154
result.data!!.lastName.shouldBe(person.lastName)
154
155
result.errors.shouldBe(emptyList())
@@ -212,23 +213,23 @@ internal class GetPersonServiceTest(
212
213
213
214
val result = getPersonService.getPrisoner(correctPrisonHmppsId, ConsumerFilters (prisons = listOf(prisonId)))
214
215
215
- result.data.shouldBeTypeOf<Person >()
216
+ result.data.shouldBeTypeOf<PersonInPrison >()
216
217
result.data!!.firstName.shouldBe(posPrisoner.firstName)
217
218
result.data!!.lastName.shouldBe(posPrisoner.lastName)
218
219
result.errors.shouldBe(emptyList())
219
220
}
220
221
221
222
it("returns prisoner if no prison filter present") {
222
223
val validHmppsId = " G2996UX"
223
- val person = Person (firstName = "Sam ", lastName = "Mills ")
224
+ val person = PersonInPrison ( Person (firstName = "Sam ", lastName = "Mills "), category = null, crsa = null, dateOfReception = null, status = null, prisonId = null, prisonName = null, cellLocation = null )
224
225
225
226
whenever(prisonerOffenderSearchGateway.getPrisonOffender(nomsNumber = validHmppsId)).thenReturn(
226
227
Response (data = POSPrisoner (firstName = "Sam ", lastName = "Mills ")),
227
228
)
228
229
229
230
val result = getPersonService.getPrisoner(validHmppsId, ConsumerFilters (prisons = null))
230
231
231
- result.data.shouldBeTypeOf<Person >()
232
+ result.data.shouldBeTypeOf<PersonInPrison >()
232
233
result.data!!.firstName.shouldBe(person.firstName)
233
234
result.data!!.lastName.shouldBe(person.lastName)
234
235
result.errors.shouldBe(emptyList())
@@ -258,15 +259,15 @@ internal class GetPersonServiceTest(
258
259
259
260
it("returns prisoner if no consumer filters present") {
260
261
val validHmppsId = " G2996UX"
261
- val person = Person (firstName = "Sam ", lastName = "Mills ")
262
+ val person = PersonInPrison ( Person (firstName = "Sam ", lastName = "Mills "), category = null, crsa = null, dateOfReception = null, status = null, prisonId = null, prisonName = null, cellLocation = null )
262
263
263
264
whenever(prisonerOffenderSearchGateway.getPrisonOffender(nomsNumber = validHmppsId)).thenReturn(
264
265
Response (data = POSPrisoner (firstName = "Sam ", lastName = "Mills ")),
265
266
)
266
267
267
268
val result = getPersonService.getPrisoner(validHmppsId, null)
268
269
269
- result.data.shouldBeTypeOf<Person >()
270
+ result.data.shouldBeTypeOf<PersonInPrison >()
270
271
result.data!!.firstName.shouldBe(person.firstName)
271
272
result.data!!.lastName.shouldBe(person.lastName)
272
273
result.errors.shouldBe(emptyList())
0 commit comments