Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-britton-moj authored Apr 16, 2024
1 parent 0496820 commit ef6749f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ internal class IntegrationTest {
Name(person.forename, person.secondName, person.surname),
person.dateOfBirth,
person.gender.description,
Conviction(
SentenceGenerator.RELEASED_EVENT.convictionDate!!,
Court(SentenceGenerator.DEFAULT_COURT.name)
),
Sentence(
SentenceGenerator.RELEASED_EVENT.convictionDate,
SentenceGenerator.RELEASED_SENTENCE.date,
Court(SentenceGenerator.DEFAULT_COURT.name),
SentenceGenerator.RELEASE.date
Expand All @@ -89,8 +92,8 @@ internal class IntegrationTest {
),
PersonGenerator.DEFAULT.dateOfBirth,
PersonGenerator.DEFAULT.gender.description,
Conviction(SentenceGenerator.DEFAULT_EVENT.convictionDate!!, Court(SentenceGenerator.DEFAULT_COURT.name)),
Sentence(
SentenceGenerator.DEFAULT_EVENT.convictionDate,
SentenceGenerator.DEFAULT_SENTENCE.date,
Court(SentenceGenerator.DEFAULT_COURT.name),
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data class CaseDetails(
val name: Name,
val dateOfBirth: LocalDate,
val gender: String,
val conviction: Conviction?,
val sentence: Sentence?,
val responsibleProvider: Provider?,
val ogrsScore: Long?
Expand All @@ -21,9 +22,13 @@ data class CaseDetails(
}

data class Name(val forename: String, val middleName: String?, val surname: String)
data class Conviction(
val date: LocalDate,
val court: Court,
)

data class Sentence(
val convictionDate: LocalDate?,
val sentenceDate: LocalDate?,
val date: LocalDate,
val sentencingCourt: Court,
val releaseDate: LocalDate?
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ class CaseDetailsService(
person.name(),
person.dateOfBirth,
person.gender.description,
Sentence(
event.convictionDate,
event.disposal?.date,
Court(courtName),
event.disposal?.custody?.mostRecentRelease()?.date
),
event.convictionDate?.let {
Conviction(it, Court(courtName))
},
event.disposal?.date?.let {
Sentence(
it,
Court(courtName),
event.disposal.custody?.mostRecentRelease()?.date
)
},
provider,
ogrsScore
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ internal class CaseDetailsTest {
Name("John", "", "Smith"),
LocalDate.of(1982, 8, 3),
"Male",
Sentence(null, LocalDate.of(2013, 9, 23), Court("NA Court"), LocalDate.of(2022, 8, 2)),
Conviction(LocalDate.now(), Court("NA Court")),
Sentence(LocalDate.of(2013, 9, 23), Court("NA Court"), LocalDate.of(2022, 8, 2)),
Provider("N00", "London"),
null
)
Expand Down

0 comments on commit ef6749f

Please sign in to comment.