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

CIV-11571 Fix court location if no specific court #3569

Merged
merged 14 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -76,6 +76,9 @@ private void updateRespondent1RequestedCourtDetails(CaseData caseData, CaseData.
}

private RequestedCourt correctCaseLocation(RequestedCourt requestedCourt, List<LocationRefData> locations) {
if (requestedCourt.getCaseLocation() == null || requestedCourt.getCaseLocation().getBaseLocation() == null) {
return requestedCourt;
}
String locationLabel = requestedCourt.getCaseLocation().getBaseLocation();
LocationRefData preferredLocation = locations.stream()
.filter(locationRefData -> courtLocationUtils.checkLocation(locationRefData, locationLabel))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,82 @@ void shouldOnlyUpdateClaimStatus_whenPartAdmitNotSettled_NoMediation() {
assertThat(data.getCaseNameHmctsInternal()).isEqualTo(data.getApplicant1().getPartyName() + " v " + data.getRespondent1().getPartyName());
}

@Test
void shouldOnlyUpdateClaimStatus_whenPartAdmitNotSettled_NoMediation_NoBaseCourt() {
Applicant1DQ applicant1DQ =
Applicant1DQ.builder().applicant1DQRequestedCourt(RequestedCourt.builder()
.caseLocation(CaseLocationCivil.builder()
.build())
.build()).build();
Respondent1DQ respondent1DQ =
Respondent1DQ.builder().respondent1DQRequestedCourt(RequestedCourt.builder()
.caseLocation(CaseLocationCivil.builder()
.build())
.build()).build();
CaseData caseData = CaseDataBuilder.builder()
.atStateClaimIssued()
.applicant1PartAdmitConfirmAmountPaidSpec(NO)
.applicant1PartAdmitIntentionToSettleClaimSpec(NO)
.applicant1DQ(applicant1DQ)
.respondent1DQ(respondent1DQ)
.applicant1AcceptAdmitAmountPaidSpec(NO)
.caseDataLip(CaseDataLiP.builder().applicant1ClaimMediationSpecRequiredLip(ClaimantMediationLip.builder().hasAgreedFreeMediation(
MediationDecision.No).build())
.build())
.build();
CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);

var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);

assertThat(response.getData())
.extracting("businessProcess")
.extracting("camundaEvent")
.isEqualTo(CLAIMANT_RESPONSE_CUI.name());
assertThat(response.getData())
.extracting("businessProcess")
.extracting("status")
.isEqualTo("READY");

CaseData data = mapper.convertValue(response.getData(), CaseData.class);
assertThat(data.getApplicant1DQ().getApplicant1DQRequestedCourt().getResponseCourtCode()).isNull();
}

@Test
void shouldOnlyUpdateClaimStatus_whenPartAdmitNotSettled_NoMediation_NoCourtSelected() {
Applicant1DQ applicant1DQ =
Applicant1DQ.builder().applicant1DQRequestedCourt(RequestedCourt.builder()
.build()).build();
Respondent1DQ respondent1DQ =
Respondent1DQ.builder().respondent1DQRequestedCourt(RequestedCourt.builder()
.build()).build();
CaseData caseData = CaseDataBuilder.builder()
.atStateClaimIssued()
.applicant1PartAdmitConfirmAmountPaidSpec(NO)
.applicant1PartAdmitIntentionToSettleClaimSpec(NO)
.applicant1DQ(applicant1DQ)
.respondent1DQ(respondent1DQ)
.applicant1AcceptAdmitAmountPaidSpec(NO)
.caseDataLip(CaseDataLiP.builder().applicant1ClaimMediationSpecRequiredLip(ClaimantMediationLip.builder().hasAgreedFreeMediation(
MediationDecision.No).build())
.build())
.build();
CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);

var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);

assertThat(response.getData())
.extracting("businessProcess")
.extracting("camundaEvent")
.isEqualTo(CLAIMANT_RESPONSE_CUI.name());
assertThat(response.getData())
.extracting("businessProcess")
.extracting("status")
.isEqualTo("READY");

CaseData data = mapper.convertValue(response.getData(), CaseData.class);
assertThat(data.getApplicant1DQ().getApplicant1DQRequestedCourt().getResponseCourtCode()).isNull();
}

@Test
void shouldChangeCaseState_whenApplicantRejectClaimSettlementAndAgreeToMediation() {
CaseData caseData = CaseDataBuilder.builder()
Expand Down
Loading