From 1000f9ad28c00a7bb488feac364a7506c3ff1838 Mon Sep 17 00:00:00 2001 From: VijayaKumarK Date: Tue, 17 Dec 2024 11:54:33 +0000 Subject: [PATCH] CIV-15613 code review comments --- .../NotificationForDefendantRepresented.java | 12 ++++++------ ...viewObligationCheckCallbackHandlerTest.java | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationForDefendantRepresented.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationForDefendantRepresented.java index 9863d2c7807..6b90f6310e8 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationForDefendantRepresented.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/notification/NotificationForDefendantRepresented.java @@ -74,12 +74,12 @@ private CallbackResponse notifyLipAfterNocApproval(CallbackParams callbackParams Map notificationTemplateMapping = setNotificationMapping(caseData, caseEvent); if (!notificationTemplateMapping.isEmpty() && notificationTemplateMapping.get(EMAIL_MAP_ID) != null && isNotEmpty(notificationTemplateMapping.get(EMAIL_MAP_ID).toString())) { -// notificationService.sendMail( -// notificationTemplateMapping.get(EMAIL_MAP_ID).toString(), -// notificationTemplateMapping.get(TEMPLATE_MAP_ID).toString(), -// setNotificationProperties(caseData, caseEvent), -// String.format(notificationTemplateMapping.get(REFERENCE_MAP_ID).toString(), caseData.getLegacyCaseReference()) -// ); + notificationService.sendMail( + notificationTemplateMapping.get(EMAIL_MAP_ID).toString(), + notificationTemplateMapping.get(TEMPLATE_MAP_ID).toString(), + setNotificationProperties(caseData, caseEvent), + String.format(notificationTemplateMapping.get(REFERENCE_MAP_ID).toString(), caseData.getLegacyCaseReference()) + ); } return AboutToStartOrSubmitCallbackResponse.builder().build(); } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/OrderReviewObligationCheckCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/OrderReviewObligationCheckCallbackHandlerTest.java index fa173911363..315710e792d 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/OrderReviewObligationCheckCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/user/OrderReviewObligationCheckCallbackHandlerTest.java @@ -137,8 +137,9 @@ void shouldNotSetObligationWAFlagWhenNoMatchingDataFound() { @ParameterizedTest @MethodSource("provideObligationDataForAllScenarios") void shouldHandleAllIfScenarios(LocalDate obligationDate, YesOrNo initialTaskRaised, ObligationReason obligationReason, - CaseState caseState, YesOrNo expectedTaskRaised, ObligationWAFlag expectedFlag) { + CaseState caseState, String manageStayOption, YesOrNo expectedTaskRaised, ObligationWAFlag expectedFlag) { CaseData caseData = CaseDataBuilder.builder().atStateApplicantRespondToDefenceAndProceed().build().builder() + .manageStayOption(manageStayOption) .storedObligationData(List.of( Element.builder() .value(ObligationData.builder() @@ -178,21 +179,28 @@ private static Stream provideObligationDataForAllScenarios() { return Stream.of( // Case 1: Obligation date is before current date, task not raised, reason is LIFT_A_STAY, case state is CASE_STAYED - arguments(currentDate.minusDays(1), YesOrNo.NO, ObligationReason.LIFT_A_STAY, CaseState.CASE_STAYED, YesOrNo.YES, + arguments(currentDate.minusDays(1), YesOrNo.NO, ObligationReason.LIFT_A_STAY, CaseState.CASE_STAYED, "REQUEST_UPDATE", YesOrNo.YES, ObligationWAFlag.builder() .currentDate(currentDate.format(formatter)) .obligationReason(ObligationReason.LIFT_A_STAY.name()) .obligationReasonDisplayValue(ObligationReason.LIFT_A_STAY.getDisplayedValue()) .build()), + arguments(currentDate.minusDays(1), YesOrNo.NO, ObligationReason.LIFT_A_STAY, CaseState.CASE_STAYED, "LIFT_STAY", YesOrNo.YES, + ObligationWAFlag.builder() + .currentDate(null) + .obligationReason(null) + .obligationReasonDisplayValue(null) + .build()), + // Case 2: Obligation date is after current date, task not raised, reason is DISMISS_CASE, case state is CASE_DISMISSED - arguments(currentDate.plusDays(1), YesOrNo.NO, ObligationReason.DISMISS_CASE, CaseState.CASE_DISMISSED, YesOrNo.NO, null), + arguments(currentDate.plusDays(1), YesOrNo.NO, ObligationReason.DISMISS_CASE, CaseState.CASE_DISMISSED, null, YesOrNo.NO, null), // Case 3: Obligation date is before current date, task already raised, reason is UNLESS_ORDER, case state is CASE_STAYED - arguments(currentDate.minusDays(1), YesOrNo.YES, ObligationReason.UNLESS_ORDER, CaseState.CASE_STAYED, YesOrNo.YES, null), + arguments(currentDate.minusDays(1), YesOrNo.YES, ObligationReason.UNLESS_ORDER, CaseState.CASE_STAYED, null, YesOrNo.YES, null), // Case 4: Obligation date is before current date, task not raised, reason is UNLESS_ORDER, case state is CASE_DISMISSED - arguments(currentDate.minusDays(1), YesOrNo.NO, ObligationReason.UNLESS_ORDER, CaseState.CASE_DISMISSED, YesOrNo.YES, + arguments(currentDate.minusDays(1), YesOrNo.NO, ObligationReason.UNLESS_ORDER, CaseState.CASE_DISMISSED, null, YesOrNo.YES, ObligationWAFlag.builder() .currentDate(currentDate.format(formatter)) .obligationReason(ObligationReason.UNLESS_ORDER.name())