Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSCSSI-82: Setting originalSender as received in the callback case details #4200

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ private SscsCaseDetails updateCase(Callback<SscsCaseData> 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);
Expand All @@ -150,6 +154,7 @@ private SscsCaseDetails updateCase(Callback<SscsCaseData> callback) {
Consumer<SscsCaseDetails> 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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<SscsCaseData> 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(),
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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());
}


Expand Down
Loading