diff --git a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/ComplianceIntegrationTest.kt b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/ComplianceIntegrationTest.kt index 2f47d6831f..28981688d5 100644 --- a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/ComplianceIntegrationTest.kt +++ b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/ComplianceIntegrationTest.kt @@ -34,17 +34,17 @@ internal class ComplianceIntegrationTest { res.previousOrders.breaches, equalTo(2) ) - assertThat(res.currentSentences[0].rarCategory, equalTo("Main")) - assertThat(res.currentSentences[1].rarCategory, equalTo(null)) - assertThat(res.currentSentences[0].eventNumber, equalTo("7654321")) - assertThat(res.currentSentences[1].eventNumber, equalTo("1234567")) - assertThat(res.currentSentences[0].activeBreach?.status, equalTo("An NSI Status")) - assertThat(res.currentSentences[0].compliance.breachStarted, equalTo(true)) - assertThat(res.currentSentences[0].compliance.currentBreaches, equalTo(1)) - assertThat(res.currentSentences[0].activity.waitingForEvidenceCount, equalTo(0)) - assertThat(res.currentSentences[0].activity.compliedAppointmentsCount, equalTo(2)) - assertThat(res.currentSentences[0].activity.outcomeNotRecordedCount, equalTo(2)) - assertThat(res.currentSentences[0].activity.acceptableAbsenceCount, equalTo(0)) + assertThat(res.currentSentences[1].rarCategory, equalTo("Main")) + assertThat(res.currentSentences[0].rarCategory, equalTo(null)) + assertThat(res.currentSentences[1].eventNumber, equalTo("7654321")) + assertThat(res.currentSentences[0].eventNumber, equalTo("1234567")) + assertThat(res.currentSentences[1].activeBreach?.status, equalTo("An NSI Status")) + assertThat(res.currentSentences[1].compliance.breachStarted, equalTo(true)) + assertThat(res.currentSentences[1].compliance.currentBreaches, equalTo(1)) + assertThat(res.currentSentences[1].activity.waitingForEvidenceCount, equalTo(0)) + assertThat(res.currentSentences[1].activity.compliedAppointmentsCount, equalTo(2)) + assertThat(res.currentSentences[1].activity.outcomeNotRecordedCount, equalTo(2)) + assertThat(res.currentSentences[1].activity.acceptableAbsenceCount, equalTo(0)) assertThat(res.previousOrders.orders[1].status, equalTo(TERMINATION_REASON.description)) } diff --git a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/OverviewIntegrationTest.kt b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/OverviewIntegrationTest.kt index 8abf7ed4a4..76068d88f0 100644 --- a/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/OverviewIntegrationTest.kt +++ b/projects/manage-supervision-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/OverviewIntegrationTest.kt @@ -66,21 +66,21 @@ internal class OverviewIntegrationTest { equalTo(ContactGenerator.FIRST_APPT_CONTACT.type.description) ) assertThat(res.sentences.size, equalTo(2)) - assertThat(res.sentences[0].mainOffence.description, equalTo(MAIN_OFFENCE_1.offence.description)) + assertThat(res.sentences[1].mainOffence.description, equalTo(MAIN_OFFENCE_1.offence.description)) assertThat( - res.sentences[0].additionalOffences[0].description, + res.sentences[1].additionalOffences[0].description, equalTo(ADDITIONAL_OFFENCE_1.offence.description) ) assertThat( - res.sentences[0].additionalOffences[1].description, + res.sentences[1].additionalOffences[1].description, equalTo(ADDITIONAL_OFFENCE_2.offence.description) ) assertThat(res.previousOrders.count, equalTo(2)) assertThat(res.previousOrders.breaches, equalTo(2)) - assertThat(res.sentences[0].rar?.completed, equalTo(1)) - assertThat(res.sentences[0].rar?.scheduled, equalTo(1)) - assertThat(res.sentences[0].rar?.totalDays, equalTo(2)) - assertThat(res.sentences[0].eventNumber, equalTo(EVENT_1.eventNumber)) + assertThat(res.sentences[1].rar?.completed, equalTo(1)) + assertThat(res.sentences[1].rar?.scheduled, equalTo(1)) + assertThat(res.sentences[1].rar?.totalDays, equalTo(2)) + assertThat(res.sentences[1].eventNumber, equalTo(EVENT_1.eventNumber)) assertThat(res.personalDetails.dateOfBirth, equalTo(OVERVIEW.dateOfBirth)) assertThat(res.personalDetails.dateOfBirth, equalTo(OVERVIEW.dateOfBirth)) assertThat(res.registrations, equalTo(listOf("Restraining Order", "Domestic Abuse Perpetrator"))) diff --git a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Event.kt b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Event.kt index 61ff39be88..61f75c82bf 100644 --- a/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Event.kt +++ b/projects/manage-supervision-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/overview/entity/Event.kt @@ -68,7 +68,7 @@ interface EventRepository : JpaRepository { "LEFT JOIN FETCH m.offence mo " + "LEFT JOIN FETCH ao.offence aoo " + "WHERE e.personId = :personId " + - "ORDER BY e.eventNumber DESC" + "ORDER BY e.dateCreated DESC" ) fun findByPersonId(personId: Long): List }