From cb662a0444d750a4307b64675dfe95529c2a3503 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 10:45:59 +0000 Subject: [PATCH 01/10] incident retry --- .../dashboard/services/TaskListService.java | 85 +++++++++++++------ .../services/TaskListServiceTest.java | 50 ++++++++++- 2 files changed, 104 insertions(+), 31 deletions(-) diff --git a/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java b/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java index 0f9f54f6f27..f1863858f04 100644 --- a/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java +++ b/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java @@ -13,6 +13,7 @@ import uk.gov.hmcts.reform.dashboard.utilities.StringUtility; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -83,42 +84,61 @@ public TaskListEntity updateTaskListItem(UUID taskItemIdentifier) { }).orElseThrow(() -> new IllegalArgumentException("Invalid task item identifier " + taskItemIdentifier)); } - private void makeProgressAbleTasksInactiveForCaseIdentifierAndRole(String caseIdentifier, String role, String excludedCategory, String excludedTemplate) { + private void makeProgressAbleTasksInactiveForCaseIdentifierAndRole(String caseIdentifier, String role, List excludedCategories, String excludedTemplate) { log.info( - "makeProgressAbleTasksInactiveForCaseIdentifierAndRole caseIdentifier:{} role: {} excludedCategory: {} excludedTemplate: {}", + "makeProgressAbleTasksInactiveForCaseIdentifierAndRole caseIdentifier:{} role: {} excludedCategories: {} excludedTemplate: {}", caseIdentifier, role, - excludedCategory, + excludedCategories, excludedTemplate ); List tasks = new ArrayList<>(); - if (Objects.nonNull(excludedCategory)) { - List categories = taskItemTemplateRepository.findByCategoryEnAndRole( - excludedCategory, - role - ); - if (Objects.nonNull(categories)) { - List catIds = categories.stream().map(TaskItemTemplateEntity::getId).toList(); + List statusesToSkip = List.of( + TaskStatus.AVAILABLE.getPlaceValue(), + TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ); + if (Objects.nonNull(excludedCategories) && !excludedCategories.isEmpty()) { + List catIds = excludedCategories.stream() + .filter(Objects::nonNull) + .flatMap(category -> { + List templates = taskItemTemplateRepository.findByCategoryEnAndRole( + category, + role + ); + return Objects.nonNull(templates) ? templates.stream() : List.of().stream(); + }) + .map(TaskItemTemplateEntity::getId) + .distinct() + .toList(); + if (!catIds.isEmpty()) { tasks = taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplate_IdNotIn( - caseIdentifier, role, List.of( - TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), - TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() - ), catIds + caseIdentifier, + role, + statusesToSkip, + catIds + ); + } else { + log.info("No task templates found for categories {} and role {} - defaulting to all progressable tasks", + excludedCategories, role); + tasks = taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( + caseIdentifier, + role, + statusesToSkip ); } } else if (Objects.nonNull(excludedTemplate)) { tasks = taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplateTemplateNameNot( - caseIdentifier, role, List.of( - TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), - TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() - ), excludedTemplate + caseIdentifier, + role, + statusesToSkip, + excludedTemplate ); } else { tasks = taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( - caseIdentifier, role, List.of( - TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), - TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() - ) + caseIdentifier, + role, + statusesToSkip ); } tasks.forEach(t -> { @@ -143,16 +163,16 @@ public void makeProgressAbleTasksInactiveForCaseIdentifierAndRole(String caseIde caseIdentifier, role ); - makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, null, null); + makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, List.of(), null); } @Transactional - public void makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory(String caseIdentifier, String role, String excludedCategory) { + public void makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory(String caseIdentifier, String role, String... excludedCategories) { log.info( - "makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory caseIdentifier:{} role: {} excludedCategory: {}", - caseIdentifier, role, excludedCategory + "makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory caseIdentifier:{} role: {} excludedCategories: {}", + caseIdentifier, role, Arrays.toString(excludedCategories) ); - makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, excludedCategory, null); + makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, normaliseCategories(excludedCategories), null); } @Transactional @@ -161,7 +181,7 @@ public void makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingTempla "makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingTemplate caseIdentifier:{} role: {} excludedTemplate: {}", caseIdentifier, role, excludedTemplate ); - makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, null, excludedTemplate); + makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseIdentifier, role, List.of(), excludedTemplate); } @Transactional @@ -188,4 +208,13 @@ private void makeViewDocumentTaskAvailable(String caseIdentifier, String role) { taskListRepository.save(task); }); } + private List normaliseCategories(String... categories) { + if (categories == null || categories.length == 0) { + return List.of(); + } + return Arrays.stream(categories) + .filter(Objects::nonNull) + .filter(category -> !category.isBlank()) + .toList(); + } } diff --git a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java index 57451806b42..5c3902aff30 100644 --- a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java +++ b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java @@ -337,13 +337,13 @@ void shouldMakeProgressAbleTaskListInactive_Except_Ga_whenTaskListIsPresent() { TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() ), - List.of(Long.valueOf(123)) + List.of(123L) )) .thenReturn(tasks); List categories = new ArrayList<>(); categories.add(TaskItemTemplateEntity.builder() - .id(Long.valueOf(123)).taskNameCy("TaskNameCy") + .id(123L).taskNameCy("TaskNameCy") .taskNameEn("TaskNameEn") .scenarioName("Scenario.hearing") .templateName("Hearing.view") @@ -372,7 +372,7 @@ void shouldMakeProgressAbleTaskListInactive_Except_Ga_whenTaskListIsPresent() { TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() ), - List.of(Long.valueOf(123)) + List.of(123L) ); verify(taskListRepository, atLeast(5)).save(ArgumentMatchers.argThat( @@ -394,6 +394,50 @@ void shouldMakeProgressAbleTaskListInactive_Except_Ga_whenTaskListIsPresent() { )); } + @Test + void shouldMakeProgressAbleTaskListInactiveForMultipleCategories_whenTaskListIsPresent() { + + List tasks = new ArrayList<>(); + tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() + .currentStatus(TaskStatus.ACTION_NEEDED.getPlaceValue()) + .taskNameEn("Link name") + .taskNameCy("Link name Welsh") + .build()); + + when(taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplate_IdNotIn( + "123", "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ), + List.of(123L, 456L) + )).thenReturn(tasks); + + List categoryA = List.of(TaskItemTemplateEntity.builder().id(123L).role("Claimant").build()); + List categoryB = List.of(TaskItemTemplateEntity.builder().id(456L).role("Claimant").build()); + + when(taskItemTemplateRepository.findByCategoryEnAndRole("CategoryA", "Claimant")).thenReturn(categoryA); + when(taskItemTemplateRepository.findByCategoryEnAndRole("CategoryB", "Claimant")).thenReturn(categoryB); + + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + "123", + "Claimant", + "CategoryA", + "CategoryB" + ); + + verify(taskItemTemplateRepository).findByCategoryEnAndRole("CategoryA", "Claimant"); + verify(taskItemTemplateRepository).findByCategoryEnAndRole("CategoryB", "Claimant"); + verify(taskListRepository).findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplate_IdNotIn( + "123", "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ), + List.of(123L, 456L) + ); + } + @Test public void shouldDeleteWhenThereWereDuplicateEntriesInTheRepository() { TaskListEntity task = getTaskListEntity(UUID.randomUUID()).toBuilder() From 1a7cd956da2d5c32401d432e1dcbfb7bc04589f4 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 14:26:10 +0000 Subject: [PATCH 02/10] Fix hearing task being inactive --- .../OrderMadeClaimantNotificationHandler.java | 8 ++-- ...OrderMadeDefendantNotificationHandler.java | 8 ++-- ...erMadeClaimantNotificationHandlerTest.java | 36 ++++++++++++++---- ...rMadeDefendantNotificationHandlerTest.java | 37 ++++++++++++++++--- 4 files changed, 70 insertions(+), 19 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index d1df440f077..03ff9e263c9 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -51,6 +51,7 @@ public class OrderMadeClaimantNotificationHandler extends OrderCallbackHandler { private final DashboardNotificationService dashboardNotificationService; private final TaskListService taskListService; public static final String GA = "Applications"; + public static final String HEARING = "Hearing"; private final SdoCaseClassificationService sdoCaseClassificationService; public OrderMadeClaimantNotificationHandler(DashboardScenariosService dashboardScenariosService, @@ -202,12 +203,13 @@ private void deleteNotificationAndInactiveTasks(CaseData caseData) { taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), "CLAIMANT", - GA + GA, HEARING ); } else { - taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole( + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), - "CLAIMANT" + "CLAIMANT", + HEARING ); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java index dcbdf40aa2a..cbe79d8eed1 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java @@ -51,6 +51,7 @@ public class OrderMadeDefendantNotificationHandler extends OrderCallbackHandler private final DashboardNotificationService dashboardNotificationService; private final TaskListService taskListService; public static final String GA = "Applications"; + public static final String HEARING = "Hearing"; private final SdoCaseClassificationService sdoCaseClassificationService; public OrderMadeDefendantNotificationHandler(DashboardScenariosService dashboardScenariosService, @@ -186,12 +187,13 @@ private void deleteNotificationAndInactiveTasks(CaseData caseData) { taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), "DEFENDANT", - GA + GA, HEARING ); } else { - taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole( + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), - "DEFENDANT" + "DEFENDANT", + HEARING ); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java index dac97a06ba7..09f02d93b8b 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java @@ -587,6 +587,23 @@ void shouldRecordScenarioClaimantFinalOrderFastTrackNotReadyTrial_whenInvoked() ); } + @Test + void shouldExcludeOnlyHearingCategoryWhenCaseProgressionDisabled() { + CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); + caseData.setApplicant1Represented(YesOrNo.NO); + when(toggleService.isCaseProgressionEnabledAndLocationWhiteListed(any())).thenReturn(false); + when(toggleService.isLocationWhiteListed(any())).thenReturn(false); + when(toggleService.isCuiGaNroEnabled()).thenReturn(false); + + CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request( + CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT.name()) + .caseDetails(CaseDetails.builder().state(All_FINAL_ORDERS_ISSUED.toString()).build()).build()).build(); + + handler.handle(params); + + verifyDeleteNotificationsAndTaskListUpdatesNotInEa(caseData); + } + @Test void shouldRecordScenarioClaimantFinalOrderFastTrackTrialReady_whenInvoked() { CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); @@ -618,21 +635,26 @@ private void verifyDeleteNotificationsAndTaskListUpdates(CaseData caseData) { caseData.getCcdCaseReference().toString(), "CLAIMANT" ); + ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - caseData.getCcdCaseReference().toString(), - "CLAIMANT", - "Applications" + eq(caseData.getCcdCaseReference().toString()), + eq("CLAIMANT"), + categoriesCaptor.capture() ); + assertThat(categoriesCaptor.getValue()) + .containsExactlyInAnyOrder("Applications", "Hearing"); } - private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseData) { verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( caseData.getCcdCaseReference().toString(), "CLAIMANT" ); - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRole( - caseData.getCcdCaseReference().toString(), - "CLAIMANT" + ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); + verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + eq(caseData.getCcdCaseReference().toString()), + eq("CLAIMANT"), + categoriesCaptor.capture() ); + assertThat(categoriesCaptor.getValue()).containsExactly("Hearing"); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java index 4e2b7c67854..64a83b1f7cc 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java @@ -581,6 +581,25 @@ void shouldRecordScenarioDefendantFinalOrderFastTrackNotReadyTrial_whenInvokedFo ); } + @Test + void shouldExcludeOnlyHearingCategoryWhenCaseProgressionDisabled() { + CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); + caseData.setRespondent1Represented(YesOrNo.NO); + when(toggleService.isCaseProgressionEnabledAndLocationWhiteListed(any())).thenReturn(false); + when(toggleService.isCarmEnabledForCase(any())).thenReturn(false); + when(toggleService.isCuiGaNroEnabled()).thenReturn(false); + when(toggleService.isLocationWhiteListed(any())).thenReturn(false); + when(toggleService.isWelshEnabledForMainCase()).thenReturn(true); + + CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request( + CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_DEFENDANT.name()) + .caseDetails(CaseDetails.builder().state(All_FINAL_ORDERS_ISSUED.toString()).build()).build()).build(); + + handler.handle(params); + + verifyDeleteNotificationsAndTaskListUpdatesNotInEa(caseData); + } + @Test void shouldRecordScenarioDefendantFinalOrderFastTrackTrialReady_whenInvoked() { CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); @@ -612,11 +631,14 @@ private void verifyDeleteNotificationsAndTaskListUpdates(CaseData caseData) { caseData.getCcdCaseReference().toString(), "DEFENDANT" ); + ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - caseData.getCcdCaseReference().toString(), - "DEFENDANT", - "Applications" + eq(caseData.getCcdCaseReference().toString()), + eq("DEFENDANT"), + categoriesCaptor.capture() ); + assertThat(categoriesCaptor.getValue()) + .containsExactlyInAnyOrder("Applications", "Hearing"); } private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseData) { @@ -624,9 +646,12 @@ private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseDat caseData.getCcdCaseReference().toString(), "DEFENDANT" ); - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRole( - caseData.getCcdCaseReference().toString(), - "DEFENDANT" + ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); + verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + eq(caseData.getCcdCaseReference().toString()), + eq("DEFENDANT"), + categoriesCaptor.capture() ); + assertThat(categoriesCaptor.getValue()).containsExactly("Hearing"); } } From 32e2f76a3caadb13bec64ab55351773c5637eebe Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 14:50:35 +0000 Subject: [PATCH 03/10] Fix hearing task being inactive --- .../claimant/OrderMadeClaimantNotificationHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index 03ff9e263c9..c7503e42cde 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -142,6 +142,7 @@ && hasTrackChanged(caseData)) { } if (isSDODrawnPreCPRelease(caseData)) { + deleteNotificationAndInactiveTasks(caseData); return SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario(); } if (isFinalOrderIssued(callbackParams)) { From 5026e8031cba7fb7ca872983a2785cb443db6792 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 15:49:44 +0000 Subject: [PATCH 04/10] Fix hearing task being inactive --- .../claimant/OrderMadeClaimantNotificationHandlerTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java index 09f02d93b8b..5ba308b0a6e 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java @@ -644,6 +644,7 @@ private void verifyDeleteNotificationsAndTaskListUpdates(CaseData caseData) { assertThat(categoriesCaptor.getValue()) .containsExactlyInAnyOrder("Applications", "Hearing"); } + private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseData) { verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( caseData.getCcdCaseReference().toString(), From 851bd8fdb7eb4156d42b2e1897d77196dba1e254 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 16:48:13 +0000 Subject: [PATCH 05/10] Fix hearing task being inactive --- .../gov/hmcts/reform/dashboard/services/TaskListService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java b/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java index f1863858f04..4e270ef73f3 100644 --- a/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java +++ b/dashboard-notifications/src/main/java/uk/gov/hmcts/reform/dashboard/services/TaskListService.java @@ -19,6 +19,7 @@ import java.util.Objects; import java.util.Optional; import java.util.UUID; +import java.util.stream.Stream; @Service @Slf4j @@ -106,7 +107,7 @@ private void makeProgressAbleTasksInactiveForCaseIdentifierAndRole(String caseId category, role ); - return Objects.nonNull(templates) ? templates.stream() : List.of().stream(); + return Objects.nonNull(templates) ? templates.stream() : Stream.of(); }) .map(TaskItemTemplateEntity::getId) .distinct() @@ -208,6 +209,7 @@ private void makeViewDocumentTaskAvailable(String caseIdentifier, String role) { taskListRepository.save(task); }); } + private List normaliseCategories(String... categories) { if (categories == null || categories.length == 0) { return List.of(); From 80da5f50c6ed88fc6f4405f569eb8083afeb5394 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 19:14:03 +0000 Subject: [PATCH 06/10] Fix hearing task being inactive --- .../services/TaskListServiceTest.java | 110 +++++++++++++++++- 1 file changed, 105 insertions(+), 5 deletions(-) diff --git a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java index 5c3902aff30..44509dd854b 100644 --- a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java +++ b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; @@ -26,6 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeast; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -120,9 +122,7 @@ void shouldThrowExceptionWhenExceptionInGetTaskList() { //then assertThrows( RuntimeException.class, - () -> { - taskListRepository.findByReferenceAndTaskItemTemplateRole(any(), any()); - } + () -> taskListRepository.findByReferenceAndTaskItemTemplateRole(any(), any()) ); } @@ -133,8 +133,8 @@ void shouldMakeProgressAbleTaskListInactive_whenTaskListIsPresent() { //given List tasks = new ArrayList<>(); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() - .taskNameEn("Link name") - .taskNameCy("Link name Welsh") + .taskNameEn("Link name") + .taskNameCy("Link name Welsh") .currentStatus(TaskStatus.NOT_AVAILABLE_YET.getPlaceValue()) .build()); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() @@ -438,6 +438,94 @@ void shouldMakeProgressAbleTaskListInactiveForMultipleCategories_whenTaskListIsP ); } + @Test + void shouldFallbackToDefaultProgressQueryWhenCategoryTemplatesMissing() { + List tasks = List.of(getTaskListEntity(UUID.randomUUID()).toBuilder() + .currentStatus(TaskStatus.IN_PROGRESS.getPlaceValue()) + .build()); + + when(taskItemTemplateRepository.findByCategoryEnAndRole("CategoryEn", "Claimant")).thenReturn(List.of()); + when(taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( + "123", + "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), + TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ) + )).thenReturn(tasks); + + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + "123", + "Claimant", + "CategoryEn" + ); + + verify(taskItemTemplateRepository).findByCategoryEnAndRole("CategoryEn", "Claimant"); + verify(taskListRepository).findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( + "123", + "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), + TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ) + ); + verify(taskListRepository, never()).findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplate_IdNotIn( + any(), + any(), + any(), + any() + ); + verify(taskListRepository, atLeast(1)).save(ArgumentMatchers.argThat( + a -> a.getCurrentStatus() == TaskStatus.INACTIVE.getPlaceValue() + )); + } + + @Test + void shouldTreatEmptyExcludedCategoriesAsNoExclusions() { + List tasks = List.of(getTaskListEntity(UUID.randomUUID()).toBuilder() + .currentStatus(TaskStatus.ACTION_NEEDED.getPlaceValue()) + .build()); + + when(taskListRepository.findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( + "123", + "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), + TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ) + )).thenReturn(tasks); + + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + "123", + "Claimant", + null, + " " + ); + + verify(taskItemTemplateRepository, never()).findByCategoryEnAndRole(any(), any()); + verify(taskListRepository).findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotIn( + "123", + "Claimant", + List.of( + TaskStatus.AVAILABLE.getPlaceValue(), + TaskStatus.DONE.getPlaceValue(), + TaskStatus.NOT_AVAILABLE_YET.getPlaceValue() + ) + ); + verify(taskListRepository, never()).findByReferenceAndTaskItemTemplateRoleAndCurrentStatusNotInAndTaskItemTemplate_IdNotIn( + any(), + any(), + any(), + any() + ); + verify(taskListRepository, atLeast(1)).save(ArgumentMatchers.argThat( + a -> a.getCurrentStatus() == TaskStatus.INACTIVE.getPlaceValue() + )); + } + @Test public void shouldDeleteWhenThereWereDuplicateEntriesInTheRepository() { TaskListEntity task = getTaskListEntity(UUID.randomUUID()).toBuilder() @@ -534,6 +622,18 @@ void shouldMakeProgressAbleTaskListActiveExcludingTemplate() { any(), any() ); + + ArgumentCaptor captor = ArgumentCaptor.forClass(TaskListEntity.class); + verify(taskListRepository, times(2)).save(captor.capture()); + List savedTasks = captor.getAllValues(); + savedTasks.forEach(saved -> { + assertThat(saved.getCurrentStatus()).isEqualTo(TaskStatus.AVAILABLE.getPlaceValue()); + assertThat(saved.getNextStatus()).isEqualTo(TaskStatus.AVAILABLE.getPlaceValue()); + assertThat(saved.getHintTextCy()).isEmpty(); + assertThat(saved.getHintTextEn()).isEmpty(); + assertThat(saved.getTaskNameEn()).isEqualTo("Link name"); + assertThat(saved.getTaskNameCy()).isEqualTo("Link name Welsh"); + }); } } From 15e4112e8e16890d9b1405e08b3d3330f4a274b0 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Mon, 16 Mar 2026 19:35:42 +0000 Subject: [PATCH 07/10] Fix hearing task being inactive --- .../dashboard/services/TaskListServiceTest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java index 44509dd854b..0f7c00d8523 100644 --- a/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java +++ b/dashboard-notifications/src/test/java/uk/gov/hmcts/reform/dashboard/services/TaskListServiceTest.java @@ -2,6 +2,7 @@ import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; @@ -28,6 +29,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -47,6 +49,11 @@ class TaskListServiceTest { @InjectMocks private TaskListService taskListService; + @BeforeEach + void resetMocks() { + reset(taskListRepository, taskItemTemplateRepository); + } + @Test void shouldReturnEmpty_whenTaskListIsNotPresent() { @@ -133,8 +140,8 @@ void shouldMakeProgressAbleTaskListInactive_whenTaskListIsPresent() { //given List tasks = new ArrayList<>(); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() - .taskNameEn("Link name") - .taskNameCy("Link name Welsh") + .taskNameEn("Link name") + .taskNameCy("Link name Welsh") .currentStatus(TaskStatus.NOT_AVAILABLE_YET.getPlaceValue()) .build()); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() @@ -574,8 +581,8 @@ void shouldMakeProgressAbleTaskListActiveExcludingTemplate() { //given List tasks = new ArrayList<>(); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() - .taskNameEn("Link name") - .taskNameCy("Link name Welsh") + .taskNameEn("Link name") + .taskNameCy("Link name Welsh") .currentStatus(TaskStatus.NOT_AVAILABLE_YET.getPlaceValue()) .build()); tasks.add(getTaskListEntity(UUID.randomUUID()).toBuilder() From 6c7348f425ba89da9fd538bd45e761d5d0d9f269 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Tue, 17 Mar 2026 14:20:24 +0000 Subject: [PATCH 08/10] Fix hearing task being inactive --- .../OrderMadeClaimantNotificationHandler.java | 11 +-- ...OrderMadeDefendantNotificationHandler.java | 8 +- .../DashboardScenarioService.java | 1 + .../FinalOrderClaimantDashboardService.java | 2 +- .../FinalOrderDefendantDashboardService.java | 2 +- .../helper/DashboardTasksHelper.java | 58 +++++++++---- ...inalOrderClaimantDashboardServiceTest.java | 11 +-- ...nalOrderDefendantDashboardServiceTest.java | 11 +-- .../helper/DashboardTasksHelperTest.java | 84 +++++++++---------- 9 files changed, 101 insertions(+), 87 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index c7503e42cde..9e38783c26d 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -44,14 +44,13 @@ public class OrderMadeClaimantNotificationHandler extends OrderCallbackHandler { private final ObjectMapper objectMapper; protected final WorkingDayIndicator workingDayIndicator; - private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT, + private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT, CREATE_DASHBOARD_NOTIFICATION_DJ_SDO_CLAIMANT, CREATE_DASHBOARD_NOTIFICATION_SDO_CLAIMANT); public static final String TASK_ID = "GenerateDashboardNotificationFinalOrderClaimant"; private final DashboardNotificationService dashboardNotificationService; private final TaskListService taskListService; public static final String GA = "Applications"; - public static final String HEARING = "Hearing"; private final SdoCaseClassificationService sdoCaseClassificationService; public OrderMadeClaimantNotificationHandler(DashboardScenariosService dashboardScenariosService, @@ -126,7 +125,6 @@ protected String getScenario(CaseData caseData, CallbackParams callbackParams) { if (isSDOEvent(callbackParams) && isEligibleForReconsideration(caseData) && Objects.isNull(caseData.getIsReferToJudgeClaim())) { - deleteNotificationAndInactiveTasks(caseData); return SCENARIO_AAA6_CP_SDO_MADE_BY_LA_CLAIMANT.getScenario(); } if (isCarmApplicableCase(caseData) @@ -204,13 +202,12 @@ private void deleteNotificationAndInactiveTasks(CaseData caseData) { taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), "CLAIMANT", - GA, HEARING + GA ); } else { - taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole( caseData.getCcdCaseReference().toString(), - "CLAIMANT", - HEARING + "CLAIMANT" ); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java index cbe79d8eed1..dcbdf40aa2a 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandler.java @@ -51,7 +51,6 @@ public class OrderMadeDefendantNotificationHandler extends OrderCallbackHandler private final DashboardNotificationService dashboardNotificationService; private final TaskListService taskListService; public static final String GA = "Applications"; - public static final String HEARING = "Hearing"; private final SdoCaseClassificationService sdoCaseClassificationService; public OrderMadeDefendantNotificationHandler(DashboardScenariosService dashboardScenariosService, @@ -187,13 +186,12 @@ private void deleteNotificationAndInactiveTasks(CaseData caseData) { taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( caseData.getCcdCaseReference().toString(), "DEFENDANT", - GA, HEARING + GA ); } else { - taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole( caseData.getCcdCaseReference().toString(), - "DEFENDANT", - HEARING + "DEFENDANT" ); } } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/DashboardScenarioService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/DashboardScenarioService.java index 2c6fc1ad8d3..10c93802769 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/DashboardScenarioService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/DashboardScenarioService.java @@ -18,6 +18,7 @@ public abstract class DashboardScenarioService { protected static final String DEFENDANT_ROLE = "DEFENDANT"; protected static final String CLAIMANT_ROLE = "CLAIMANT"; + public static final String HEARING_TASK_CATEGORY = "Hearing"; protected DashboardScenarioService(DashboardScenariosService dashboardScenariosService, DashboardNotificationsParamsMapper mapper) { diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardService.java index 42e05dd68fb..9b586832892 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardService.java @@ -37,7 +37,7 @@ public void notifyFinalOrder(CaseData caseData, String authToken) { @Override protected String getScenario(CaseData caseData) { - dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + dashboardTasksHelper.deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); final String scenario; diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardService.java index 04f4d4804cf..5083fd9a2c5 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardService.java @@ -37,7 +37,7 @@ public void notifyFinalOrder(CaseData caseData, String authToken) { @Override protected String getScenario(CaseData caseData) { - dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); final String scenario; diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelper.java b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelper.java index 9fec5d9787f..ce95c3bdbb1 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelper.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelper.java @@ -6,6 +6,10 @@ import uk.gov.hmcts.reform.dashboard.services.DashboardNotificationService; import uk.gov.hmcts.reform.dashboard.services.TaskListService; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + @Service public class DashboardTasksHelper { @@ -13,6 +17,8 @@ public class DashboardTasksHelper { private final FeatureToggleService featureToggleService; private final DashboardNotificationService dashboardNotificationService; + private static final String APPLICATIONS = "Applications"; + public DashboardTasksHelper(TaskListService taskListService, FeatureToggleService featureToggleService, DashboardNotificationService dashboardNotificationService) { @@ -21,32 +27,48 @@ public DashboardTasksHelper(TaskListService taskListService, this.dashboardNotificationService = dashboardNotificationService; } - public void deleteNotificationAndInactiveTasksForClaimant(CaseData caseData) { - deleteNotificationAndInactiveTasksForRole(caseData, "CLAIMANT"); + public void deleteNotificationAndInactiveTasksForClaimant(CaseData caseData, String... excludeCategory) { + deleteNotificationAndInactiveTasksForRole(caseData, "CLAIMANT", excludeCategory); } - public void deleteNotificationAndInactiveTasksForDefendant(CaseData caseData) { - deleteNotificationAndInactiveTasksForRole(caseData, "DEFENDANT"); + public void deleteNotificationAndInactiveTasksForDefendant(CaseData caseData, String... excludeCategories) { + deleteNotificationAndInactiveTasksForRole(caseData, "DEFENDANT", excludeCategories); } - private void deleteNotificationAndInactiveTasksForRole(CaseData caseData, String citizenRole) { - dashboardNotificationService.deleteByReferenceAndCitizenRole( - caseData.getCcdCaseReference().toString(), - citizenRole - ); + private void deleteNotificationAndInactiveTasksForRole( + CaseData caseData, + String citizenRole, + String... excludeCategories) { - if (featureToggleService.isLocationWhiteListed(caseData.getCaseManagementLocation().getBaseLocation()) - || featureToggleService.isCuiGaNroEnabled()) { + String caseReference = caseData.getCcdCaseReference().toString(); + + dashboardNotificationService.deleteByReferenceAndCitizenRole(caseReference, citizenRole); + + List categories = buildCategories(caseData, excludeCategories); + + if (categories.isEmpty()) { + taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole(caseReference, citizenRole); + } else { taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - caseData.getCcdCaseReference().toString(), + caseReference, citizenRole, - "Applications" - ); - } else { - taskListService.makeProgressAbleTasksInactiveForCaseIdentifierAndRole( - caseData.getCcdCaseReference().toString(), - citizenRole + categories.toArray(new String[0]) ); } } + + private List buildCategories(CaseData caseData, String... excludeCategories) { + List categories = new ArrayList<>(); + + if (excludeCategories != null) { + categories.addAll(Arrays.asList(excludeCategories)); + } + + if (featureToggleService.isLocationWhiteListed(caseData.getCaseManagementLocation().getBaseLocation()) + || featureToggleService.isCuiGaNroEnabled()) { + categories.add(APPLICATIONS); + } + + return categories; + } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardServiceTest.java index 33a7f183ca3..33afefacaa6 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderClaimantDashboardServiceTest.java @@ -23,6 +23,7 @@ import static org.mockito.Mockito.when; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_UPDATE_DASHBOARD_CLAIMANT_TASK_LIST_UPLOAD_DOCUMENTS_FINAL_ORDERS; import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_UPDATE_TASK_LIST_TRIAL_READY_FINALS_ORDERS_CLAIMANT; +import static uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardScenarioService.HEARING_TASK_CATEGORY; @ExtendWith(MockitoExtension.class) class FinalOrderClaimantDashboardServiceTest { @@ -63,7 +64,7 @@ void shouldRecordScenarioClaimantFinalOrderFastTrackNotReadyTrial_whenInvoked() caseData.getCcdCaseReference().toString(), ScenarioRequestParams.builder().params(scenarioParams).build() ); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -87,7 +88,7 @@ void shouldRecordScenarioClaimantFinalOrderFastTrackTrialReady_whenInvoked() { caseData.getCcdCaseReference().toString(), ScenarioRequestParams.builder().params(scenarioParams).build() ); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -102,7 +103,7 @@ void shouldNotRecordScenario_whenApplicant1Represented() { finalOrderClaimantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -118,7 +119,7 @@ void shouldNotRecordScenario_whenLipVLipDisabled() { finalOrderClaimantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -135,6 +136,6 @@ void shouldNotRecordScenario_whenDashBoardDisabled() { finalOrderClaimantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForClaimant(caseData, HEARING_TASK_CATEGORY); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardServiceTest.java index f3bf2fdb354..bfcde828967 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/finalorder/FinalOrderDefendantDashboardServiceTest.java @@ -21,6 +21,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; +import static uk.gov.hmcts.reform.civil.service.dashboardnotifications.DashboardScenarioService.HEARING_TASK_CATEGORY; @ExtendWith(MockitoExtension.class) class FinalOrderDefendantDashboardServiceTest { @@ -60,7 +61,7 @@ void shouldRecordScenarioDefendantFinalOrderFastTrackNotReadyTrial_whenInvoked() caseData.getCcdCaseReference().toString(), ScenarioRequestParams.builder().params(new HashMap<>()).build() ); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -83,7 +84,7 @@ void shouldRecordScenarioDefendantFinalOrderFastTrackTrialReady_whenInvoked() { caseData.getCcdCaseReference().toString(), ScenarioRequestParams.builder().params(new HashMap<>()).build() ); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -99,7 +100,7 @@ void shouldNotRecordScenario_whenRespondentRepresented() { finalOrderDefendantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -116,7 +117,7 @@ void shouldNotRecordScenario_whenLipVLipDisabled() { finalOrderDefendantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); } @Test @@ -134,6 +135,6 @@ void shouldNotRecordScenario_whenDashBoardDisabled() { finalOrderDefendantDashboardService.notifyFinalOrder(caseData, AUTH_TOKEN); verifyNoInteractions(dashboardScenariosService); - verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData); + verify(dashboardTasksHelper).deleteNotificationAndInactiveTasksForDefendant(caseData, HEARING_TASK_CATEGORY); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelperTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelperTest.java index 026b8b124ad..822997da9e5 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelperTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/dashboardnotifications/helper/DashboardTasksHelperTest.java @@ -2,6 +2,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @@ -12,6 +13,8 @@ import uk.gov.hmcts.reform.dashboard.services.DashboardNotificationService; import uk.gov.hmcts.reform.dashboard.services.TaskListService; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -32,24 +35,7 @@ class DashboardTasksHelperTest { private DashboardTasksHelper dashboardTasksHelper; @Test - void shouldExcludeApplicationsForClaimantWhenLocationWhitelisted() { - CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); - when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(true); - - dashboardTasksHelper.deleteNotificationAndInactiveTasksForClaimant(caseData); - - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - CCD_REFERENCE.toString(), - "CLAIMANT", - "Applications" - ); - verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( - CCD_REFERENCE.toString(), - "CLAIMANT"); - } - - @Test - void shouldDeleteNotificationAndInactiveTasksForClaimantWhenNoWhitelistOrCuiGaNro() { + void shouldDeleteNotificationWithoutExclusionsWhenFeatureTogglesDisabled() { CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(false); when(featureToggleService.isCuiGaNroEnabled()).thenReturn(false); @@ -66,73 +52,81 @@ void shouldDeleteNotificationAndInactiveTasksForClaimantWhenNoWhitelistOrCuiGaNr } @Test - void shouldExcludeApplicationsForClaimantWhenCuiGaNroEnabled() { + void shouldAddApplicationsWhenLocationIsWhitelisted() { CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); - when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(false); - when(featureToggleService.isCuiGaNroEnabled()).thenReturn(true); + when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(true); dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + ArgumentCaptor captor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - CCD_REFERENCE.toString(), - "DEFENDANT", - "Applications" + eq(CCD_REFERENCE.toString()), + eq("DEFENDANT"), + captor.capture() ); + assertThat(captor.getValue()).containsExactly("Applications"); verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( CCD_REFERENCE.toString(), "DEFENDANT"); } @Test - void shouldExcludeApplicationsForDefendantWhenLocationWhitelisted() { + void shouldAddApplicationsWhenCuiGaNroEnabled() { CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); - when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(true); + when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(false); + when(featureToggleService.isCuiGaNroEnabled()).thenReturn(true); - dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + dashboardTasksHelper.deleteNotificationAndInactiveTasksForClaimant(caseData); + ArgumentCaptor captor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - CCD_REFERENCE.toString(), - "DEFENDANT", - "Applications" + eq(CCD_REFERENCE.toString()), + eq("CLAIMANT"), + captor.capture() ); + assertThat(captor.getValue()).containsExactly("Applications"); verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( CCD_REFERENCE.toString(), - "DEFENDANT"); + "CLAIMANT"); } @Test - void shouldDeleteNotificationAndInactiveTasksForDefendantWhenNoWhitelistOrCuiGaNro() { + void shouldIncludeProvidedCategoriesWhenTogglesDisabled() { CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(false); when(featureToggleService.isCuiGaNroEnabled()).thenReturn(false); - dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + dashboardTasksHelper.deleteNotificationAndInactiveTasksForClaimant(caseData, "CategoryA", "CategoryB"); - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRole( - CCD_REFERENCE.toString(), - "DEFENDANT" + ArgumentCaptor captor = ArgumentCaptor.forClass(String[].class); + verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( + eq(CCD_REFERENCE.toString()), + eq("CLAIMANT"), + captor.capture() ); + assertThat(captor.getValue()).containsExactly("CategoryA", "CategoryB"); verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( CCD_REFERENCE.toString(), - "DEFENDANT"); + "CLAIMANT"); } @Test - void shouldExcludeApplicationsForDefendantWhenCuiGaNroEnabled() { + void shouldAppendApplicationsAfterExtrasWhenToggleEnabled() { CaseData caseData = caseData(BASE_LOCATION, CCD_REFERENCE); - when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(false); - when(featureToggleService.isCuiGaNroEnabled()).thenReturn(true); + when(featureToggleService.isLocationWhiteListed(BASE_LOCATION)).thenReturn(true); - dashboardTasksHelper.deleteNotificationAndInactiveTasksForDefendant(caseData); + dashboardTasksHelper.deleteNotificationAndInactiveTasksForClaimant(caseData, "CategoryX"); + ArgumentCaptor captor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - CCD_REFERENCE.toString(), - "DEFENDANT", - "Applications" + eq(CCD_REFERENCE.toString()), + eq("CLAIMANT"), + captor.capture() ); + assertThat(captor.getValue()).containsExactly("CategoryX", "Applications"); verify(dashboardNotificationService).deleteByReferenceAndCitizenRole( CCD_REFERENCE.toString(), - "DEFENDANT"); + "CLAIMANT"); } private CaseData caseData(String baseLocation, Long ccdCaseReference) { From 721e2da2b79347853a521111126876e571a1f6d8 Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Wed, 18 Mar 2026 09:40:27 +0000 Subject: [PATCH 09/10] Fix hearing task being inactive --- .../claimant/OrderMadeClaimantNotificationHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index 9e38783c26d..0340227247b 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -44,7 +44,7 @@ public class OrderMadeClaimantNotificationHandler extends OrderCallbackHandler { private final ObjectMapper objectMapper; protected final WorkingDayIndicator workingDayIndicator; - private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT, + private static final List EVENTS = List.of(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT, CREATE_DASHBOARD_NOTIFICATION_DJ_SDO_CLAIMANT, CREATE_DASHBOARD_NOTIFICATION_SDO_CLAIMANT); public static final String TASK_ID = "GenerateDashboardNotificationFinalOrderClaimant"; From 668b2566a5b52aa1a5aacbffd50c74add3d3a20b Mon Sep 17 00:00:00 2001 From: mounikaammineni Date: Wed, 18 Mar 2026 10:47:39 +0000 Subject: [PATCH 10/10] Fix hearing task being inactive --- .../OrderMadeClaimantNotificationHandler.java | 2 +- ...erMadeClaimantNotificationHandlerTest.java | 35 +++--------------- ...rMadeDefendantNotificationHandlerTest.java | 37 +++---------------- 3 files changed, 13 insertions(+), 61 deletions(-) diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java index 0340227247b..d1df440f077 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandler.java @@ -125,6 +125,7 @@ protected String getScenario(CaseData caseData, CallbackParams callbackParams) { if (isSDOEvent(callbackParams) && isEligibleForReconsideration(caseData) && Objects.isNull(caseData.getIsReferToJudgeClaim())) { + deleteNotificationAndInactiveTasks(caseData); return SCENARIO_AAA6_CP_SDO_MADE_BY_LA_CLAIMANT.getScenario(); } if (isCarmApplicableCase(caseData) @@ -140,7 +141,6 @@ && hasTrackChanged(caseData)) { } if (isSDODrawnPreCPRelease(caseData)) { - deleteNotificationAndInactiveTasks(caseData); return SCENARIO_AAA6_CLAIMANT_SDO_DRAWN_PRE_CASE_PROGRESSION.getScenario(); } if (isFinalOrderIssued(callbackParams)) { diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java index 5ba308b0a6e..dac97a06ba7 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/claimant/OrderMadeClaimantNotificationHandlerTest.java @@ -587,23 +587,6 @@ void shouldRecordScenarioClaimantFinalOrderFastTrackNotReadyTrial_whenInvoked() ); } - @Test - void shouldExcludeOnlyHearingCategoryWhenCaseProgressionDisabled() { - CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); - caseData.setApplicant1Represented(YesOrNo.NO); - when(toggleService.isCaseProgressionEnabledAndLocationWhiteListed(any())).thenReturn(false); - when(toggleService.isLocationWhiteListed(any())).thenReturn(false); - when(toggleService.isCuiGaNroEnabled()).thenReturn(false); - - CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request( - CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_CLAIMANT.name()) - .caseDetails(CaseDetails.builder().state(All_FINAL_ORDERS_ISSUED.toString()).build()).build()).build(); - - handler.handle(params); - - verifyDeleteNotificationsAndTaskListUpdatesNotInEa(caseData); - } - @Test void shouldRecordScenarioClaimantFinalOrderFastTrackTrialReady_whenInvoked() { CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); @@ -635,14 +618,11 @@ private void verifyDeleteNotificationsAndTaskListUpdates(CaseData caseData) { caseData.getCcdCaseReference().toString(), "CLAIMANT" ); - ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - eq(caseData.getCcdCaseReference().toString()), - eq("CLAIMANT"), - categoriesCaptor.capture() + caseData.getCcdCaseReference().toString(), + "CLAIMANT", + "Applications" ); - assertThat(categoriesCaptor.getValue()) - .containsExactlyInAnyOrder("Applications", "Hearing"); } private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseData) { @@ -650,12 +630,9 @@ private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseDat caseData.getCcdCaseReference().toString(), "CLAIMANT" ); - ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - eq(caseData.getCcdCaseReference().toString()), - eq("CLAIMANT"), - categoriesCaptor.capture() + verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRole( + caseData.getCcdCaseReference().toString(), + "CLAIMANT" ); - assertThat(categoriesCaptor.getValue()).containsExactly("Hearing"); } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java index 64a83b1f7cc..4e2b7c67854 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/handler/callback/camunda/dashboardnotifications/defendant/OrderMadeDefendantNotificationHandlerTest.java @@ -581,25 +581,6 @@ void shouldRecordScenarioDefendantFinalOrderFastTrackNotReadyTrial_whenInvokedFo ); } - @Test - void shouldExcludeOnlyHearingCategoryWhenCaseProgressionDisabled() { - CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); - caseData.setRespondent1Represented(YesOrNo.NO); - when(toggleService.isCaseProgressionEnabledAndLocationWhiteListed(any())).thenReturn(false); - when(toggleService.isCarmEnabledForCase(any())).thenReturn(false); - when(toggleService.isCuiGaNroEnabled()).thenReturn(false); - when(toggleService.isLocationWhiteListed(any())).thenReturn(false); - when(toggleService.isWelshEnabledForMainCase()).thenReturn(true); - - CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request( - CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FINAL_ORDER_DEFENDANT.name()) - .caseDetails(CaseDetails.builder().state(All_FINAL_ORDERS_ISSUED.toString()).build()).build()).build(); - - handler.handle(params); - - verifyDeleteNotificationsAndTaskListUpdatesNotInEa(caseData); - } - @Test void shouldRecordScenarioDefendantFinalOrderFastTrackTrialReady_whenInvoked() { CaseData caseData = CaseDataBuilder.builder().atAllFinalOrdersIssuedCheck().build(); @@ -631,14 +612,11 @@ private void verifyDeleteNotificationsAndTaskListUpdates(CaseData caseData) { caseData.getCcdCaseReference().toString(), "DEFENDANT" ); - ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - eq(caseData.getCcdCaseReference().toString()), - eq("DEFENDANT"), - categoriesCaptor.capture() + caseData.getCcdCaseReference().toString(), + "DEFENDANT", + "Applications" ); - assertThat(categoriesCaptor.getValue()) - .containsExactlyInAnyOrder("Applications", "Hearing"); } private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseData) { @@ -646,12 +624,9 @@ private void verifyDeleteNotificationsAndTaskListUpdatesNotInEa(CaseData caseDat caseData.getCcdCaseReference().toString(), "DEFENDANT" ); - ArgumentCaptor categoriesCaptor = ArgumentCaptor.forClass(String[].class); - verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRoleExcludingCategory( - eq(caseData.getCcdCaseReference().toString()), - eq("DEFENDANT"), - categoriesCaptor.capture() + verify(taskListService).makeProgressAbleTasksInactiveForCaseIdentifierAndRole( + caseData.getCcdCaseReference().toString(), + "DEFENDANT" ); - assertThat(categoriesCaptor.getValue()).containsExactly("Hearing"); } }