From 3cf4a2a8b17be67df9a6c436bc9ebcf71dba8ce3 Mon Sep 17 00:00:00 2001 From: hmcts-version1-ignacio <107860328+hmcts-version1-ignacio@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:04:55 +0100 Subject: [PATCH] CIV-14552 VALIDATE_DISCONTINUE_CLAIM_CLAIMANT event: notifications (#1043) * CIV-14552 Update Camunda diagram * CIV-14552 Unit tests incomplete * CIV-14552 validate discontinuance test * CIV-14552 validate discontinuance test * CIV-14552 validate discontinuance test * CIV-14552 validate discontinuance test * CIV-14552 validate discontinuance test * CIV-14552 CheckStyle fix * CIV-14552 CheckStyle fix --------- Co-authored-by: Omaira-Melo-Hmcts <148855113+Omaira-Melo-Hmcts@users.noreply.github.com> Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> --- .../validate_discontinue_claim_claimant.bpmn | 197 +++++++++++++++--- .../ValidateDiscontinueClaimClaimantTest.java | 66 +++++- 2 files changed, 229 insertions(+), 34 deletions(-) diff --git a/src/main/resources/camunda/validate_discontinue_claim_claimant.bpmn b/src/main/resources/camunda/validate_discontinue_claim_claimant.bpmn index b03e9f700..6c258974f 100644 --- a/src/main/resources/camunda/validate_discontinue_claim_claimant.bpmn +++ b/src/main/resources/camunda/validate_discontinue_claim_claimant.bpmn @@ -1,5 +1,5 @@ - + Flow_1if0h68 @@ -14,7 +14,8 @@ Flow_0gitrv4 - Flow_1n9ug08 + Flow_0txpf2p + Flow_02a1r9o Flow_1hce35l @@ -53,7 +54,7 @@ Flow_0gitrv4 - + ${discontinuanceValidationSuccess} @@ -66,6 +67,69 @@ Flow_0evp3v5 + + + + NOTIFY_DISCONTINUANCE_DEFENDANT1 + + + Flow_1n9ug08 + Flow_050q4bi + + + + Flow_050q4bi + Flow_0dlaffe + Flow_12d1lyq + + + ${empty flowFlags.UNREPRESENTED_DEFENDANT_ONE || (!empty flowFlags.UNREPRESENTED_DEFENDANT_ONE && !flowFlags.UNREPRESENTED_DEFENDANT_ONE)} + + + + + SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1 + + + Flow_12d1lyq + Flow_0enmo9z + + + + + NOTIFY_DISCONTINUANCE_CLAIMANT1 + + + Flow_0dlaffe + Flow_0enmo9z + Flow_19493u9 + + + + Flow_19493u9 + Flow_04nwyba + Flow_02a1r9o + + + ${(!empty flowFlags.TWO_RESPONDENT_REPRESENTATIVES && flowFlags.TWO_RESPONDENT_REPRESENTATIVES && (empty flowFlags.UNREPRESENTED_DEFENDANT_TWO || !flowFlags.UNREPRESENTED_DEFENDANT_TWO))} + + + + + NOTIFY_DISCONTINUANCE_DEFENDANT2 + + + Flow_04nwyba + Flow_0txpf2p + + + + ${!(!empty flowFlags.TWO_RESPONDENT_REPRESENTATIVES && flowFlags.TWO_RESPONDENT_REPRESENTATIVES && (empty flowFlags.UNREPRESENTED_DEFENDANT_TWO || !flowFlags.UNREPRESENTED_DEFENDANT_TWO))} + + + ${!empty flowFlags.UNREPRESENTED_DEFENDANT_ONE && flowFlags.UNREPRESENTED_DEFENDANT_ONE} + + @@ -82,33 +146,55 @@ - - - - - - - + - + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -117,6 +203,10 @@ + + + + @@ -127,35 +217,78 @@ - + - - - + + + + + + - - + + - - - - + + + - + - - - + + + + + + + + + + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/uk/gov/hmcts/reform/civil/bpmn/ValidateDiscontinueClaimClaimantTest.java b/src/test/java/uk/gov/hmcts/reform/civil/bpmn/ValidateDiscontinueClaimClaimantTest.java index bddab7d25..22d08b11a 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/bpmn/ValidateDiscontinueClaimClaimantTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/bpmn/ValidateDiscontinueClaimClaimantTest.java @@ -7,6 +7,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import java.util.Map; + import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -20,20 +22,31 @@ public class ValidateDiscontinueClaimClaimantTest extends BpmnBaseTest { = "NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT"; public static final String UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE = "UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE"; + public static final String NOTIFY_DISCONTINUANCE_DEFENDANT1 = "NOTIFY_DISCONTINUANCE_DEFENDANT1"; + public static final String SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1 = "SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1"; //ACTIVITY IDs public static final String NOTIFY_VALIDATION_DICONTINUANCE_FAILURE_CLAIMANT_ACTIVITY_ID = "NotifyValidationFailureClaimant"; public static final String UPDATE_VISIBILITY_NOTICE_OF_DISCONTINUANCE_ACTIVITY_ID = "UpdateVisibilityNoticeOfDiscontinuance"; + public static final String SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1_ACTIVITY_ID = "PostNoticeOfDiscontinuanceDefendant1LiP"; + public static final String NOTIFY_DISCONTINUANCE_CLAIMANT1_ACTIVITY_ID = "NotifyDiscontinuanceClaimant"; + public static final String NOTIFY_DISCONTINUANCE_DEFENDANT1_ACTIVITY_ID = "NotifyDiscontinuanceDefendant1"; public ValidateDiscontinueClaimClaimantTest() { super("validate_discontinue_claim_claimant.bpmn", PROCESS_ID); } @ParameterizedTest - @CsvSource({"true", "false"}) - void shouldSuccessfullyComplete(boolean discontinuanceValidationSuccess) { + @CsvSource({ + "false, false, false, false", + "true, false, false, false", + "true, true, true, false", + "true, true, true, true" + }) + void shouldSuccessfullyComplete(boolean discontinuanceValidationSuccess, boolean unrepresentedDefendant1, + boolean twoDefendants, boolean unrepresentedDefendant2) { //assert process has started assertFalse(processInstance.isEnded()); @@ -43,6 +56,9 @@ void shouldSuccessfullyComplete(boolean discontinuanceValidationSuccess) { VariableMap variables = Variables.createVariables(); variables.put("discontinuanceValidationSuccess", discontinuanceValidationSuccess); + variables.put(FLOW_FLAGS, Map.of(UNREPRESENTED_DEFENDANT_ONE, unrepresentedDefendant1, + TWO_RESPONDENT_REPRESENTATIVES, twoDefendants, + UNREPRESENTED_DEFENDANT_TWO, unrepresentedDefendant2)); //complete the start business process ExternalTask startBusiness = assertNextExternalTask(START_BUSINESS_TOPIC); @@ -76,6 +92,52 @@ void shouldSuccessfullyComplete(boolean discontinuanceValidationSuccess) { ); } + if (discontinuanceValidationSuccess) { + //complete Notify Discontinuance Defendant 1 + ExternalTask notificationDiscontTask = assertNextExternalTask(PROCESS_CASE_EVENT); + assertCompleteExternalTask( + notificationDiscontTask, + PROCESS_CASE_EVENT, + NOTIFY_DISCONTINUANCE_DEFENDANT1, + NOTIFY_DISCONTINUANCE_DEFENDANT1_ACTIVITY_ID, + variables + ); + + if (unrepresentedDefendant1) { + //complete Post Notice of Discontinuance Defendant 1 LiP + ExternalTask postNoticeDiscontinuanceTask = assertNextExternalTask(PROCESS_CASE_EVENT); + assertCompleteExternalTask( + postNoticeDiscontinuanceTask, + PROCESS_CASE_EVENT, + SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1, + SEND_DISCONTINUANCE_LETTER_LIP_DEFENDANT1_ACTIVITY_ID, + variables + ); + } + + //complete Notify Discontinuance Claimant + ExternalTask claimant1Notification = assertNextExternalTask(PROCESS_CASE_EVENT); + assertCompleteExternalTask( + claimant1Notification, + PROCESS_CASE_EVENT, + "NOTIFY_DISCONTINUANCE_CLAIMANT1", + NOTIFY_DISCONTINUANCE_CLAIMANT1_ACTIVITY_ID, + variables + ); + + if (twoDefendants && !unrepresentedDefendant2) { + //complete Notify Discontinuance Defendant 2 + ExternalTask defendant2LRNotification = assertNextExternalTask(PROCESS_CASE_EVENT); + assertCompleteExternalTask( + defendant2LRNotification, + PROCESS_CASE_EVENT, + "NOTIFY_DISCONTINUANCE_DEFENDANT2", + "NotifyDiscontinuanceDefendant2", + variables + ); + } + } + ExternalTask endBusinessProcess = assertNextExternalTask(END_BUSINESS_PROCESS); completeBusinessProcess(endBusinessProcess);