diff --git a/projects/offender-events-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt b/projects/offender-events-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt index 82caf7b12e..b516699c74 100644 --- a/projects/offender-events-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt +++ b/projects/offender-events-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt @@ -1,5 +1,7 @@ package uk.gov.justice.digital.hmpps +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.hasItems import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource @@ -16,8 +18,6 @@ import uk.gov.justice.digital.hmpps.integrations.delius.offender.OffenderDeltaRe import uk.gov.justice.digital.hmpps.integrations.delius.offender.OffenderDeltaService import uk.gov.justice.digital.hmpps.messaging.HmppsChannelManager import uk.gov.justice.digital.hmpps.telemetry.TelemetryService -import java.time.format.DateTimeFormatter.ISO_ZONED_DATE_TIME -import java.time.temporal.ChronoUnit @SpringBootTest internal class IntegrationTest { @@ -48,7 +48,7 @@ internal class IntegrationTest { expected.forEach { verify(telemetryService, timeout(30000)).trackEvent( eq("OffenderEventPublished"), - eq(it + ("occurredAt" to ISO_ZONED_DATE_TIME.format(delta.dateChanged.truncatedTo(ChronoUnit.SECONDS)))), + check { properties -> assertThat(properties.entries, hasItems(*it.entries.toTypedArray())) }, any() ) } diff --git a/projects/offender-events-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/offender/OffenderDeltaService.kt b/projects/offender-events-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/offender/OffenderDeltaService.kt index 0f3a07c0c2..7fa2763c1c 100644 --- a/projects/offender-events-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/offender/OffenderDeltaService.kt +++ b/projects/offender-events-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/integrations/delius/offender/OffenderDeltaService.kt @@ -33,7 +33,8 @@ class OffenderDeltaService( mapOf( "crn" to it.message.crn, "eventType" to it.eventType!!, - "occurredAt" to ISO_ZONED_DATE_TIME.format(it.message.eventDatetime) + "occurredAt" to ISO_ZONED_DATE_TIME.format(it.message.eventDatetime), + "notification" to it.toString(), ) ) }