Skip to content

Commit

Permalink
Log offender-event notifications to Telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-bcl committed Nov 6, 2024
1 parent 137a9c3 commit e2508d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
)
}
Expand Down

0 comments on commit e2508d5

Please sign in to comment.