diff --git a/build.gradle b/build.gradle index 2d2f22d5414..ca6ca6fb433 100644 --- a/build.gradle +++ b/build.gradle @@ -315,7 +315,7 @@ sonarqube { property "sonar.projectKey", "civil-service" property "sonar.coverage.jacoco.xmlReportPaths", "${jacocoTestReport.reports.xml.destination.path}" property "sonar.coverage.exclusions", "**/model/**, **/config/**/*Configuration.java, **/testingsupport/**, **/*ExternalTaskListener.java, **/*BaseExternalTaskHandler.java, **/stereotypes/**, **/*Exception.java, **/EventHistoryMapper*.java, **/model/hearingvalues/**, **/enums/hearing/**, **/fees/client/**, **/enums/sdo/**, **/service/PaymentsService.java, **/RetriggerCases*.java" - property "sonar.cpd.exclusions", "**/*DocumentManagementService.java, **/*Spec*.java" + property "sonar.cpd.exclusions", "**/*DocumentManagementService.java, **/*Spec*.java, **/*CcdDashboardClaimantClaimMatcher.java" property "sonar.exclusions", "**/hmc/model/**, **/model/hearingvalues/**" property "sonar.host.url", "https://sonar.reform.hmcts.net/" } diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimantClaimMatcher.java similarity index 99% rename from src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java rename to src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimantClaimMatcher.java index fe45e29d735..0b6bb762b99 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimantClaimMatcher.java @@ -18,7 +18,7 @@ @Slf4j @AllArgsConstructor -public class CcdDashboardClaimMatcher implements Claim { +public class CcdDashboardClaimantClaimMatcher implements Claim { private static final LocalTime FOUR_PM = LocalTime.of(16, 1, 0); private CaseData caseData; diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardDefendantClaimMatcher.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardDefendantClaimMatcher.java new file mode 100644 index 00000000000..03a1ebab9d1 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardDefendantClaimMatcher.java @@ -0,0 +1,297 @@ +package uk.gov.hmcts.reform.civil.model.citizenui; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import uk.gov.hmcts.reform.civil.enums.CaseState; +import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec; +import uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec; +import uk.gov.hmcts.reform.civil.enums.YesOrNo; +import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.sdo.FastTrackHearingTime; +import uk.gov.hmcts.reform.civil.model.sdo.SmallClaimsHearing; +import uk.gov.hmcts.reform.civil.service.FeatureToggleService; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Objects; +import java.util.Optional; + +@Slf4j +@AllArgsConstructor +public class CcdDashboardDefendantClaimMatcher implements Claim { + + private static final LocalTime FOUR_PM = LocalTime.of(16, 1, 0); + private CaseData caseData; + private FeatureToggleService featureToggleService; + + @Override + public boolean hasResponsePending() { + return caseData.getRespondent1ResponseDate() == null && !isPaperResponse(); + } + + @Override + public boolean hasResponsePendingOverdue() { + return caseData.getRespondent1ResponseDeadline() != null + && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM)) + && caseData.hasBreathingSpace(); + } + + @Override + public boolean hasResponseDueToday() { + return caseData.getRespondent1ResponseDeadline() != null + && caseData.getRespondent1ResponseDeadline().toLocalDate().isEqual(LocalDate.now()) + && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM)); + } + + @Override + public boolean hasResponseFullAdmit() { + return caseData.getRespondent1ClaimResponseTypeForSpec() != null + && caseData.getRespondent1ClaimResponseTypeForSpec() == RespondentResponseTypeSpec.FULL_ADMISSION; + } + + @Override + public boolean defendantRespondedWithFullAdmitAndPayImmediately() { + return hasResponseFullAdmit() + && isPayImmediately(); + } + + @Override + public boolean defendantRespondedWithFullAdmitAndPayBySetDate() { + return hasResponseFullAdmit() + && caseData.isPayBySetDate() + && (Objects.isNull(caseData.getApplicant1AcceptFullAdmitPaymentPlanSpec())); + } + + @Override + public boolean defendantRespondedWithFullAdmitAndPayByInstallments() { + return hasResponseFullAdmit() + && caseData.isPayByInstallment() + && (Objects.isNull(caseData.getApplicant1AcceptFullAdmitPaymentPlanSpec())); + } + + @Override + public boolean hasResponseDeadlineBeenExtended() { + return caseData.getRespondent1TimeExtensionDate() != null; + } + + @Override + public boolean isEligibleForCCJ() { + return caseData.getRespondent1ResponseDeadline() != null + && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM)) + && caseData.getPaymentTypeSelection() == null; + } + + @Override + public boolean claimantConfirmedDefendantPaid() { + return caseData.getRespondent1CourtOrderPayment() != null && caseData.respondent1PaidInFull(); + } + + @Override + public boolean isSettled() { + return !caseData.isRespondentResponseFullDefence() + && (caseData.respondent1PaidInFull() + || caseData.isResponseAcceptedByClaimant()) + && Objects.isNull(caseData.getCcjPaymentDetails()) + && !caseData.hasApplicantRejectedRepaymentPlan() + || caseData.isPartAdmitClaimSettled(); + } + + @Override + public boolean isSentToCourt() { + return false; + } + + @Override + public boolean claimantRequestedCountyCourtJudgement() { + return caseData.getApplicant1DQ() != null && caseData.getApplicant1DQ().getApplicant1DQRequestedCourt() != null + && !hasSdoBeenDrawn(); + } + + @Override + public boolean isWaitingForClaimantToRespond() { + return RespondentResponseTypeSpec.FULL_DEFENCE == caseData.getRespondent1ClaimResponseTypeForSpec() + && caseData.getApplicant1ResponseDate() == null; + } + + @Override + public boolean isProceedOffline() { + return false; + } + + @Override + public boolean isPaperResponse() { + if (!featureToggleService.isLipVLipEnabled()) { + return false; + } + + return Objects.nonNull(caseData.getTakenOfflineDate()) && Objects.nonNull(caseData.getCcdState()) + && caseData.getCcdState().equals(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM); + } + + @Override + public boolean hasChangeRequestFromDefendant() { + return false; + } + + @Override + public boolean hasChangeRequestedFromClaimant() { + return false; + } + + @Override + public boolean isPassedToCountyCourtBusinessCentre() { + return false; + } + + @Override + public boolean hasClaimantAskedToSignSettlementAgreement() { + return false; + } + + @Override + public boolean hasClaimantAcceptedPartialAdmissionAmount() { + return hasDefendantStatedTheyPaid() && caseData.isResponseAcceptedByClaimant(); + } + + @Override + public boolean haveBothPartiesSignedSettlementAgreement() { + return false; + } + + @Override + public boolean hasCCJByRedetermination() { + return caseData.hasApplicantAcceptedRepaymentPlan(); + } + + @Override + public boolean hasDefendantStatedTheyPaid() { + return defendantRespondedWithPartAdmit() + && isPayImmediately() && !caseData.getApplicant1ResponseDeadlinePassed() + && !(caseData.hasApplicantRejectedRepaymentPlan() || caseData.isPartAdmitClaimNotSettled()); + } + + private boolean isPayImmediately() { + return RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY == caseData.getDefenceAdmitPartPaymentTimeRouteRequired(); + } + + @Override + public boolean defendantRespondedWithPartAdmit() { + return RespondentResponseTypeSpec.PART_ADMISSION == caseData.getRespondent1ClaimResponseTypeForSpec() + && !caseData.getApplicant1ResponseDeadlinePassed() + && !(caseData.hasApplicantRejectedRepaymentPlan() || caseData.isPartAdmitClaimNotSettled()); + } + + @Override + public boolean isHearingFormGenerated() { + return !caseData.getHearingDocuments().isEmpty(); + } + + @Override + public boolean hasSdoBeenDrawn() { + return caseData.getSDODocument().isPresent(); + } + + @Override + public boolean isBeforeHearing() { + return isBeforeSmallClaimHearing() || (isBeforeFastTrackHearing() || noHearingScheduled()); + } + + private boolean noHearingScheduled() { + return caseData.getSmallClaimsHearing() == null && caseData.getFastTrackHearingTime() == null; + } + + private boolean isBeforeSmallClaimHearing() { + return Optional.ofNullable(caseData.getSmallClaimsHearing()) + .map(SmallClaimsHearing::getDateFrom) + .map(hearingFromDate -> hearingFromDate.isAfter(LocalDate.now())) + .orElse(false); + } + + private boolean isBeforeFastTrackHearing() { + return Optional.ofNullable(caseData.getFastTrackHearingTime()) + .map(FastTrackHearingTime::getDateFrom) + .map(hearingFromDate -> hearingFromDate.isAfter(LocalDate.now())) + .orElse(false); + } + + @Override + public boolean isMoreDetailsRequired() { + return hasSdoBeenDrawn() && isBeforeHearing() && featureToggleService.isCaseProgressionEnabled(); + } + + @Override + public boolean isMediationSuccessful() { + return !hasSdoBeenDrawn() + && Objects.nonNull(caseData.getMediation()) + && Objects.nonNull(caseData.getMediation().getMediationSuccessful()) + && Objects.nonNull(caseData.getMediation().getMediationSuccessful().getMediationAgreement()); + } + + @Override + public boolean isMediationUnsuccessful() { + return !hasSdoBeenDrawn() + && Objects.nonNull(caseData.getMediation()) + && Objects.nonNull(caseData.getMediation().getUnsuccessfulMediationReason()) + && !caseData.getMediation().getUnsuccessfulMediationReason().isEmpty(); + } + + @Override + public boolean isMediationPending() { + return Objects.nonNull(caseData.getCcdState()) + && caseData.getCcdState().equals(CaseState.IN_MEDIATION) + && Objects.nonNull(caseData.getMediation()) + && Objects.nonNull(caseData.getMediation().getMediationSuccessful()) + && Objects.isNull(caseData.getMediation().getMediationSuccessful().getMediationAgreement()); + } + + @Override + public boolean isCourtReviewing() { + return (!hasSdoBeenDrawn() + && caseData.isRespondentResponseFullDefence() + && caseData.getCcdState().equals(CaseState.JUDICIAL_REFERRAL)) + || (caseData.hasApplicantRejectedRepaymentPlan()); + } + + @Override + public boolean hasClaimEnded() { + return (Objects.nonNull(caseData.getApplicant1ProceedsWithClaimSpec()) + && caseData.getApplicant1ProceedsWithClaimSpec().equals(YesOrNo.NO) + && caseData.isRespondentResponseFullDefence()) + || caseData.getApplicant1ResponseDeadlinePassed(); + } + + @Override + public boolean isClaimRejectedAndOfferSettleOutOfCourt() { + return false; + } + + @Override + public boolean claimantAcceptedOfferOutOfCourt() { + return false; + } + + @Override + public boolean hasClaimantRejectOffer() { + return false; + } + + @Override + public boolean isPartialAdmissionRejected() { + return CaseState.JUDICIAL_REFERRAL.equals(caseData.getCcdState()) + && caseData.isPartAdmitClaimSpec(); + } + + @Override + public boolean isSDOOrderCreated() { + return caseData.getHearingDate() == null + && CaseState.CASE_PROGRESSION.equals(caseData.getCcdState()); + } + + @Override + public boolean isClaimantDefaultJudgement() { + return caseData.getRespondent1ResponseDeadline() != null + && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM)) + && caseData.getPaymentTypeSelection() != null; + } + +} diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java index 058ab6c0eb8..80c31e0759f 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java @@ -7,8 +7,10 @@ import uk.gov.hmcts.reform.ccd.client.model.SearchResult; import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter; import uk.gov.hmcts.reform.civil.model.CaseData; -import uk.gov.hmcts.reform.civil.model.citizenui.CcdDashboardClaimMatcher; +import uk.gov.hmcts.reform.civil.model.citizenui.CcdDashboardClaimantClaimMatcher; +import uk.gov.hmcts.reform.civil.model.citizenui.CcdDashboardDefendantClaimMatcher; import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimInfo; +import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimStatus; import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimStatusFactory; import uk.gov.hmcts.reform.civil.model.citizenui.DashboardResponse; import uk.gov.hmcts.reform.civil.service.CoreCaseDataService; @@ -54,7 +56,7 @@ public DashboardResponse getDashboardDefendantResponse(String authorisation, Str var ccdData = coreCaseDataService.getCCDClaimsForLipDefendant(authorisation, startIndex); int totalPages = getTotalPagesToBeListed(ccdData.getTotal() + ocmcClaims.size()); List currentPageItems = currentPage <= totalPages - ? getDashboardItemsForCurrentPage(ocmcClaims, currentPage, ccdData) : + ? getDashboardItemsForCurrentPage(ocmcClaims, currentPage, ccdData, false) : Collections.emptyList(); return DashboardResponse.builder().totalPages(totalPages).claims(currentPageItems).build(); } @@ -71,7 +73,7 @@ public DashboardResponse getDashboardClaimantResponse(String authorisation, Stri int totalPages = getTotalPagesToBeListed(getCcdClaimsCount(ccdData) + ocmcClaims.size()); List currentPageItems = currentPage <= totalPages - ? getDashboardItemsForCurrentPage(ocmcClaims, currentPage, ccdData) : + ? getDashboardItemsForCurrentPage(ocmcClaims, currentPage, ccdData, true) : Collections.emptyList(); return DashboardResponse.builder().totalPages(totalPages).claims(currentPageItems).build(); } @@ -84,7 +86,8 @@ private List getClaimsForClaimant(String authorisation, Stri private List getDashboardItemsForCurrentPage(List ocmcClaims, int currentPage, - SearchResult ccdClaims) { + SearchResult ccdClaims, + boolean isClaimant) { int startIndex = (currentPage - 1) * CASES_PER_PAGE; int endIndex = startIndex + CASES_PER_PAGE; @@ -96,7 +99,7 @@ private List getDashboardItemsForCurrentPage(List ccdClaimsCount) { int remainingRecords = CASES_PER_PAGE - ccdData.size(); @@ -114,16 +117,19 @@ private List sortOcmcCases(List ocmcCase .collect(Collectors.toList()); } - private List translateSearchResultToDashboardItems(SearchResult claims) { + private List translateSearchResultToDashboardItems(SearchResult claims, boolean isClaimant) { if (claims == null) { return Collections.emptyList(); } - return claims.getCases().stream().map(caseDetails -> translateCaseDataToDashboardClaimInfo(caseDetails)) + return claims.getCases().stream().map(caseDetails -> translateCaseDataToDashboardClaimInfo( + caseDetails, + isClaimant + )) .collect(Collectors.toList()); } - private DashboardClaimInfo translateCaseDataToDashboardClaimInfo(CaseDetails caseDetails) { + private DashboardClaimInfo translateCaseDataToDashboardClaimInfo(CaseDetails caseDetails, boolean isClaimant) { CaseData caseData = caseDetailsConverter.toCaseData(caseDetails); DashboardClaimInfo item = DashboardClaimInfo.builder().claimId(String.valueOf(caseData.getCcdCaseReference())) .createdDate(submittedDateToCreatedDate(caseData)) @@ -133,7 +139,7 @@ private DashboardClaimInfo translateCaseDataToDashboardClaimInfo(CaseDetails cas .claimAmount(nonNull(caseData.getTotalClaimAmount()) ? caseData.getTotalClaimAmount() : null) .admittedAmount(caseData.getPartAdmitPaidValuePounds()) .responseDeadlineTime(caseData.getRespondent1ResponseDeadline()) - .status(dashboardClaimStatusFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher(caseData, featureToggleService))) + .status(getStatus(isClaimant, caseData)) .build(); if (caseData.getRespondent1ResponseDeadline() != null) { item.setResponseDeadline(caseData.getRespondent1ResponseDeadline().toLocalDate()); @@ -170,4 +176,16 @@ private int getCcdClaimsCount(final SearchResult ccdClaims) { return Optional.ofNullable(ccdClaims).map(SearchResult::getTotal).orElse(0); } + + private DashboardClaimStatus getStatus(boolean isClaimant, CaseData caseData) { + return isClaimant + ? dashboardClaimStatusFactory.getDashboardClaimStatus(new CcdDashboardClaimantClaimMatcher( + caseData, + featureToggleService + )) + : dashboardClaimStatusFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( + caseData, + featureToggleService + )); + } } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdClaimStatusDashboardFactoryTest.java b/src/test/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdClaimStatusDashboardFactoryTest.java index 50208255a98..3b77acb3d44 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdClaimStatusDashboardFactoryTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdClaimStatusDashboardFactoryTest.java @@ -56,7 +56,7 @@ void given_hasResponsePending_whenGetStatus_thenReturnNoResponse() { .respondent1ResponseDeadline(LocalDate.now().plusDays(10).atTime(16, 0, 0)) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.NO_RESPONSE); } @@ -68,7 +68,7 @@ void given_isEligibleForCCJ_whenGetStatus_thenReturnEligibleForCCJStatus() { .respondent1ResponseDeadline(LocalDateTime.of(2022, 2, 2, 16, 0)) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.ELIGIBLE_FOR_CCJ); } @@ -81,7 +81,7 @@ void given_isEligibleForCCJ_whenGetStatus_thenReturnDefaultJudgementStatus() { .paymentTypeSelection(DJPaymentTypeSelection.IMMEDIATELY) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.DEFAULT_JUDGEMENT); } @@ -92,7 +92,7 @@ void given_hasResponseDueToday_whenGetStatus_thenReturnResponseDueNow() { .respondent1ResponseDeadline(LocalDate.now().atTime(10, 0, 0)) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.RESPONSE_DUE_NOW); } @@ -104,7 +104,7 @@ void given_moreTimeRequested_whenGetStatus_thenReturnMoreTimeRequested() { .respondent1TimeExtensionDate(LocalDateTime.now().plusDays(30)) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.MORE_TIME_REQUESTED); } @@ -113,7 +113,7 @@ void given_moreTimeRequested_whenGetStatus_thenReturnMoreTimeRequested() { void given_responseAdmitPayImmediately_whenGetStatus_thenReturnAdmitPayImmediately() { CaseData claim = getClaimWithFullAdmitResponse(RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.ADMIT_PAY_IMMEDIATELY); } @@ -122,7 +122,7 @@ void given_responseAdmitPayImmediately_whenGetStatus_thenReturnAdmitPayImmediate void given_responseAdmitPayBySetDate_whenGetStatus_thenReturnAdmitPayBySetDate() { CaseData claim = getClaimWithFullAdmitResponse(RespondentResponsePartAdmissionPaymentTimeLRspec.BY_SET_DATE); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.ADMIT_PAY_BY_SET_DATE); } @@ -131,7 +131,7 @@ void given_responseAdmitPayBySetDate_whenGetStatus_thenReturnAdmitPayBySetDate() void given_responseAdmitPayByInstallments_whenGetStatus_thenReturnAdmitPayByInstallments() { CaseData claim = getClaimWithFullAdmitResponse(RespondentResponsePartAdmissionPaymentTimeLRspec.SUGGESTION_OF_REPAYMENT_PLAN); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.ADMIT_PAY_INSTALLMENTS); } @@ -145,7 +145,7 @@ void given_claimantConfirmedDefendantPaid_whenGetStatus_thenReturnClaimantAccept .respondent1ClaimResponsePaymentAdmissionForSpec(RespondentResponseTypeSpecPaidStatus.PAID_FULL_OR_MORE_THAN_CLAIMED_AMOUNT) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.CLAIMANT_ACCEPTED_STATES_PAID); } @@ -158,7 +158,7 @@ void given_defendantPayedInFull_whenGetStatus_thenReturnSettled() { .respondent1ClaimResponsePaymentAdmissionForSpec(RespondentResponseTypeSpecPaidStatus.PAID_FULL_OR_MORE_THAN_CLAIMED_AMOUNT) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.SETTLED); } @@ -171,7 +171,7 @@ void given_claimantAcceptedDefendantResponse_whenGetStatus_thenReturnSettled() { .applicant1AcceptAdmitAmountPaidSpec(YesOrNo.YES) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.SETTLED); } @@ -184,7 +184,7 @@ void given_claimantRequestedCountyCourtJudgement_whenGetStatus_thenReturnRequest .applicant1DQ(Applicant1DQ.builder().applicant1DQRequestedCourt(RequestedCourt.builder().build()).build()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.REQUESTED_COUNTRY_COURT_JUDGEMENT); } @@ -198,7 +198,7 @@ void given_claimantAcceptedAdmission_whenGetStatus_thenReturnRelevantStatus() { .defenceAdmitPartPaymentTimeRouteRequired(RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY) .applicant1AcceptPartAdmitPaymentPlanSpec(YesOrNo.YES) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.CLAIMANT_ACCEPTED_ADMISSION_OF_AMOUNT); } @@ -210,7 +210,7 @@ void given_defendantRespondedWithPartAdmit_whenGetStatus_thenReturnRelevantStatu .respondent1ResponseDate(LocalDateTime.now()) .respondent1ClaimResponseTypeForSpec(RespondentResponseTypeSpec.PART_ADMISSION) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.DEFENDANT_PART_ADMIT); } @@ -223,7 +223,7 @@ void given_hearingNoticeDocumentIssued_whenGetStatus_thenReturnHearingFormGenera .documentName("testDoc") .build()).build())) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.HEARING_FORM_GENERATED); } @@ -244,7 +244,7 @@ void given_hearingDateForSmallClaimIsAfterToday_and_SDOBeenDrawn_whenGetStatus_m .systemGeneratedCaseDocuments(List.of(document)) .build(); given(featureToggleService.isCaseProgressionEnabled()).willReturn(true); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.MORE_DETAILS_REQUIRED); } @@ -265,7 +265,7 @@ void given_hearingDateForFastTrackClaimIsAfterToday_and_SDOBeenDrawn_whenGetStat .systemGeneratedCaseDocuments(List.of(document)) .build(); given(featureToggleService.isCaseProgressionEnabled()).willReturn(true); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.MORE_DETAILS_REQUIRED); } @@ -280,7 +280,7 @@ void given_mediation_whenGetSatus_mediationSuccessful() { .build()) .build()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.MEDIATION_SUCCESSFUL); } @@ -293,7 +293,7 @@ void given_mediation_whenGetStatus_mediationUnsuccessful() { .unsuccessfulMediationReason("this is a reason") .build()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.MEDIATION_UNSUCCESSFUL); } @@ -308,7 +308,7 @@ void given_mediation_whenGetStatus_mediationPending() { .build()) .build()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.IN_MEDIATION); } @@ -321,7 +321,7 @@ void given_court_whenGetStatus_courtReview() { .respondent1ClaimResponseTypeForSpec(RespondentResponseTypeSpec.FULL_DEFENCE) .applicant1ResponseDate(LocalDateTime.now()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.WAITING_COURT_REVIEW); } @@ -334,7 +334,7 @@ void given_respondentFullDefenceAndApplicantNotProceedsWithClaim_whenGetStatus_c .respondent1ClaimResponseTypeForSpec(RespondentResponseTypeSpec.FULL_DEFENCE) .applicant1ResponseDate(LocalDateTime.now()) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.CLAIM_ENDED); } @@ -347,7 +347,7 @@ void given_applicantRejectPartialAdmit_whenGetStatus_rejectOffer() { .applicant1AcceptPartAdmitPaymentPlanSpec(YesOrNo.NO) .ccdState(CaseState.JUDICIAL_REFERRAL) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.CLAIMANT_REJECT_PARTIAL_ADMISSION); } @@ -376,7 +376,7 @@ void given_SDOBeenDrawn_whenGetStatus_sdoOrderCreatedRequired() { .ccdState(CaseState.CASE_PROGRESSION) .build(); DashboardClaimStatus status = - ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.SDO_ORDER_CREATED); } @@ -388,7 +388,7 @@ void given_claimantNotRespondedWithInDeadLine_whenGetStatus_claimEnded() { .applicant1ResponseDeadline(LocalDateTime.now().minusDays(1)) .build(); DashboardClaimStatus status = - ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.CLAIM_ENDED); } @@ -401,7 +401,7 @@ void given_claimantRejectsDefendantsPaymentPlan() { .applicant1AcceptPartAdmitPaymentPlanSpec(YesOrNo.NO) .ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.WAITING_COURT_REVIEW); } @@ -418,7 +418,7 @@ void givenClaimStatusInProcessHeritageSystem_WhenGetStatus_thenReturnResponseByP .ccdState(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM) .build(); - DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardClaimMatcher( + DashboardClaimStatus status = ccdClaimStatusDashboardFactory.getDashboardClaimStatus(new CcdDashboardDefendantClaimMatcher( claim, featureToggleService)); assertThat(status).isEqualTo(DashboardClaimStatus.RESPONSE_BY_POST);