Skip to content

Commit

Permalink
SSCSSI-82: Setting originalSender as received in the callback case de…
Browse files Browse the repository at this point in the history
…tails (#4200)

Co-authored-by: gokul <69240498+gokul-sol@users.noreply.github.com>
Co-authored-by: sanjayparekh-hmcts <36845702+sanjayparekh-hmcts@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 9, 2024
1 parent 81cd360 commit a75f55d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
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

0 comments on commit a75f55d

Please sign in to comment.