diff --git a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandler.java index 0ad6c364416..3a7a2dc4bd3 100644 --- a/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandler.java +++ b/src/main/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandler.java @@ -141,7 +141,11 @@ private SscsCaseDetails updateCase(Callback callback) { ); } - return setInterlocReviewStateFieldAndTriggerEvent(sscsCaseDetails -> setSelectWhoReviewsCaseField(sscsCaseDetails.getData(), REVIEW_BY_JUDGE), + return setInterlocReviewStateFieldAndTriggerEvent( + sscsCaseDetails -> { + setSelectWhoReviewsCaseField(sscsCaseDetails.getData(), REVIEW_BY_JUDGE); + sscsCaseDetails.getData().setOriginalSender(callback.getCaseDetails().getCaseData().getOriginalSender()); + }, callback.getCaseDetails().getId(), REVIEW_BY_JUDGE, SEND_TO_INTERLOC_REVIEW_BY_JUDGE, EventType.VALID_SEND_TO_INTERLOC, TCW_REVIEW_SEND_TO_JUDGE); @@ -150,6 +154,7 @@ private SscsCaseDetails updateCase(Callback callback) { Consumer caseDataConsumer = sscsCaseDetails -> { SscsCaseData sscsCaseData = sscsCaseDetails.getData(); setSelectWhoReviewsCaseField(sscsCaseData, REVIEW_BY_TCW); + sscsCaseData.setOriginalSender(callback.getCaseDetails().getCaseData().getOriginalSender()); if (isPostponementRequest(sscsCaseData)) { sscsCaseData.setInterlocReferralReason(InterlocReferralReason.REVIEW_POSTPONEMENT_REQUEST); } diff --git a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandlerTest.java b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandlerTest.java index 761d7e05834..bb790bc67a6 100644 --- a/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandlerTest.java +++ b/src/test/java/uk/gov/hmcts/reform/sscs/ccd/presubmit/furtherevidence/actionfurtherevidence/ActionFurtherEvidenceSubmittedCallbackHandlerTest.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.reform.sscs.ccd.presubmit.furtherevidence.actionfurtherevidence; +import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; @@ -12,6 +13,7 @@ import static uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType.ABOUT_TO_SUBMIT; import static uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType.SUBMITTED; import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.*; +import static uk.gov.hmcts.reform.sscs.ccd.domain.InterlocReviewState.REVIEW_BY_JUDGE; import static uk.gov.hmcts.reform.sscs.ccd.presubmit.furtherevidence.actionfurtherevidence.FurtherEvidenceActionDynamicListItems.SEND_TO_INTERLOC_REVIEW_BY_JUDGE; import java.time.LocalDate; @@ -181,8 +183,12 @@ public void givenFurtherEvidenceActionSelectedOption_shouldTriggerEventAndUpdate given(ccdClient.startEvent(idamTokens, 123L, UPDATE_CASE_ONLY.getCcdType())).willReturn(startEventResponse); + + DynamicList originalSender = new DynamicList(new DynamicListItem("appellant", "Appellant (or Appointee)"),null); + Callback callback = buildCallback(furtherEvidenceActionSelectedOption, ACTION_FURTHER_EVIDENCE); SscsCaseData sscsCaseData = callback.getCaseDetails().getCaseData(); + sscsCaseData.setOriginalSender(originalSender); given(sscsCcdConvertService.getCaseData(startEventResponse.getCaseDetails().getData())).willReturn(sscsCaseData); given(updateCcdCaseService.updateCaseV2(anyLong(), eq(eventType), anyString(), anyString(), @@ -208,6 +214,13 @@ public void givenFurtherEvidenceActionSelectedOption_shouldTriggerEventAndUpdate || furtherEvidenceActionSelectedOption.equals("informationReceivedForInterlocTcw")) { assertThat(sscsCaseData.getInterlocReferralDate(), is(LocalDate.now())); } + + if (eventType.equals("validSendToInterloc")) { + assertThat(sscsCaseData.getSelectWhoReviewsCase(), + equalTo(new DynamicList(new DynamicListItem(interlocReviewState.getCcdDefinition(), null), null))); + assertThat(sscsCaseData.getOriginalSender(), + equalTo(originalSender)); + } } @Test @@ -255,7 +268,7 @@ public void givenPostHearingAndFurtherEvidenceActionIsReviewByJudge_shouldTrigge SscsCaseDetails sscsCaseDetails = SscsCaseDetails.builder().data(sscsCaseData).build(); captor.getValue().accept(sscsCaseDetails); - assertEquals(InterlocReviewState.REVIEW_BY_JUDGE, sscsCaseData.getInterlocReviewState()); + assertEquals(REVIEW_BY_JUDGE, sscsCaseData.getInterlocReviewState()); } @Ignore("Re-enable once new post hearings B types are added to the enum") @@ -569,7 +582,7 @@ public void givenPostHearingOtherAndFurtherEvidenceActionIsReviewByJudge_shouldT SscsCaseDetails sscsCaseDetails = SscsCaseDetails.builder().data(sscsCaseData).build(); captor.getValue().accept(sscsCaseDetails); - assertEquals(InterlocReviewState.REVIEW_BY_JUDGE, sscsCaseData.getInterlocReviewState()); + assertEquals(REVIEW_BY_JUDGE, sscsCaseData.getInterlocReviewState()); }