From 7eebbb311aaf7282d7cb3c891c3e447461c82451 Mon Sep 17 00:00:00 2001 From: mcengiz Date: Wed, 20 May 2026 11:38:39 +0100 Subject: [PATCH] CAD-1283: Do not suppress the hearing notices to prosecutors for Ex-Parte Civil case --- .../helper/HearingNotificationHelper.java | 14 ++++++-------- .../helper/HearingNotificationHelperTest.java | 8 ++++++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/progression-event/progression-event-processor/src/main/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelper.java b/progression-event/progression-event-processor/src/main/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelper.java index 54da64a2ae..d6d41b3e78 100644 --- a/progression-event/progression-event-processor/src/main/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelper.java +++ b/progression-event/progression-event-processor/src/main/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelper.java @@ -337,14 +337,12 @@ private void sendHearingNotificationToProsecutor(final ProsecutionCase prosecuti final UUID notificationId = randomUUID(); addCourtDocument(jsonEnvelope, caseId, materialId, fileName); - if(shouldSendTheNotifications(prosecutionCase, defendant)) { - if (isNotEmpty(prosecutorEmail)) { - saveNotificationInfo(notificationId, RecipientType.PROSECUTOR, CommunicationType.EMAIL.getType()); - sendEmail(hearingNotificationInputData, jsonEnvelope, caseId, prosecutorEmail, materialId, materialUrl, notificationId); - } else { - saveNotificationInfo(notificationId, RecipientType.PROSECUTOR, CommunicationType.LETTER.getType()); - notificationService.sendLetter(jsonEnvelope, notificationId, caseId, null, materialId, true); - } + if (isNotEmpty(prosecutorEmail)) { + saveNotificationInfo(notificationId, RecipientType.PROSECUTOR, CommunicationType.EMAIL.getType()); + sendEmail(hearingNotificationInputData, jsonEnvelope, caseId, prosecutorEmail, materialId, materialUrl, notificationId); + } else { + saveNotificationInfo(notificationId, RecipientType.PROSECUTOR, CommunicationType.LETTER.getType()); + notificationService.sendLetter(jsonEnvelope, notificationId, caseId, null, materialId, true); } } diff --git a/progression-event/progression-event-processor/src/test/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelperTest.java b/progression-event/progression-event-processor/src/test/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelperTest.java index 74c12d6e1c..6784b17ab7 100644 --- a/progression-event/progression-event-processor/src/test/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelperTest.java +++ b/progression-event/progression-event-processor/src/test/java/uk/gov/moj/cpp/progression/helper/HearingNotificationHelperTest.java @@ -284,7 +284,7 @@ void sendHearingNotifications_EmailToAllRelevantParties_WhenCivilCaseExparteFals } @Test - void shouldNotSendHearingNotifications_NoNotificationSentToAllRelevantParties_WhenCivilCaseExparteTrue() { + void sendHearingNotifications_EmailToDefendants_WhenCivilCaseExparteTrue() { final UUID caseId = randomUUID(); final UUID defendantId = randomUUID(); @@ -320,7 +320,11 @@ void shouldNotSendHearingNotifications_NoNotificationSentToAllRelevantParties_Wh hearingNotificationHelper.sendHearingNotificationsToRelevantParties(jsonEnvelope, inputData); - verifyNoInteractions(notificationService); + verify(notificationService, times(1)).sendEmail(any(), any(), any(), any(), any(), prosecutorEmailCapture.capture()); + + final List emailChannels = prosecutorEmailCapture.getValue(); + verifyEmailChannel(emailChannels, "Crown.Court.Results@merseyside.police.uk", fromString(TEMPLATE_ID)); + verify(documentGeneratorService, times(2)).generateNonNowDocument(any(), any(), any(), any(), any()); }