-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIV-10986 case not proceeding to judicial referral (#3411)
* CIV-10986 fix one_v_two_two_rep validation * Update suppressions.xml * Remove updated supressions * CIV-10986 update spec shouldMoveToJudicialReferral * refactor shouldMoveToJudicialReferral method --------- Co-authored-by: mfallonhmcts <[email protected]>
- Loading branch information
1 parent
f5a23fd
commit 61943ed
Showing
6 changed files
with
127 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/uk/gov/hmcts/reform/civil/utils/JudicialReferralUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package uk.gov.hmcts.reform.civil.utils; | ||
|
||
import uk.gov.hmcts.reform.civil.enums.AllocatedTrack; | ||
import uk.gov.hmcts.reform.civil.enums.CaseCategory; | ||
import uk.gov.hmcts.reform.civil.enums.MultiPartyScenario; | ||
import uk.gov.hmcts.reform.civil.enums.YesOrNo; | ||
import uk.gov.hmcts.reform.civil.model.CaseData; | ||
|
||
import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.getAllocatedTrack; | ||
import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.getMultiPartyScenario; | ||
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES; | ||
|
||
public class JudicialReferralUtils { | ||
|
||
private JudicialReferralUtils() { | ||
//NO-OP | ||
} | ||
|
||
/** | ||
* Computes whether the case data should move to judicial referral or not. | ||
* | ||
* @param caseData a case data such that defendants rejected the claim, and claimant(s) wants to proceed | ||
* vs all the defendants | ||
* @return true if and only if the case should move to judicial referral | ||
*/ | ||
public static boolean shouldMoveToJudicialReferral(CaseData caseData) { | ||
CaseCategory caseCategory = caseData.getCaseAccessCategory(); | ||
|
||
if (CaseCategory.SPEC_CLAIM.equals(caseCategory)) { | ||
MultiPartyScenario multiPartyScenario = getMultiPartyScenario(caseData); | ||
|
||
return switch (multiPartyScenario) { | ||
case ONE_V_ONE, ONE_V_TWO_ONE_LEGAL_REP, ONE_V_TWO_TWO_LEGAL_REP -> caseData.getApplicant1ProceedWithClaim() == YesOrNo.YES; | ||
case TWO_V_ONE -> caseData.getApplicant1ProceedWithClaimSpec2v1() == YesOrNo.YES; | ||
}; | ||
} else { | ||
AllocatedTrack allocatedTrack = | ||
getAllocatedTrack( | ||
CaseCategory.UNSPEC_CLAIM.equals(caseCategory) | ||
? caseData.getClaimValue().toPounds() | ||
: caseData.getTotalClaimAmount(), | ||
caseData.getClaimType() | ||
); | ||
if (AllocatedTrack.MULTI_CLAIM.equals(allocatedTrack)) { | ||
return false; | ||
} | ||
MultiPartyScenario multiPartyScenario = getMultiPartyScenario(caseData); | ||
return switch (multiPartyScenario) { | ||
case ONE_V_ONE -> caseData.getApplicant1ProceedWithClaim() == YesOrNo.YES; | ||
case TWO_V_ONE -> caseData.getApplicant1ProceedWithClaimMultiParty2v1() == YES | ||
&& caseData.getApplicant2ProceedWithClaimMultiParty2v1() == YES; | ||
case ONE_V_TWO_ONE_LEGAL_REP, ONE_V_TWO_TWO_LEGAL_REP -> | ||
caseData.getApplicant1ProceedWithClaimAgainstRespondent1MultiParty1v2() == YES | ||
&& caseData.getApplicant1ProceedWithClaimAgainstRespondent2MultiParty1v2() == YES; | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/test/java/uk/gov/hmcts/reform/civil/utils/JudicialReferralUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package uk.gov.hmcts.reform.civil.utils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import uk.gov.hmcts.reform.civil.enums.CaseCategory; | ||
import uk.gov.hmcts.reform.civil.enums.YesOrNo; | ||
import uk.gov.hmcts.reform.civil.model.CaseData; | ||
import uk.gov.hmcts.reform.civil.model.ClaimValue; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
|
||
public class JudicialReferralUtilsTest { | ||
|
||
@Test | ||
public void testShouldMoveToJudicialReferralForSpecClaim() { | ||
CaseData caseData = CaseData.builder() | ||
.caseAccessCategory(CaseCategory.SPEC_CLAIM) | ||
.applicant1ProceedWithClaim(YesOrNo.YES) | ||
.build(); | ||
|
||
boolean judicialReferralUtils = JudicialReferralUtils.shouldMoveToJudicialReferral(caseData); | ||
assertTrue(judicialReferralUtils); | ||
} | ||
|
||
@Test | ||
public void testShouldNotMoveToJudicialReferralForSpecClaim() { | ||
CaseData caseData = CaseData.builder() | ||
.caseAccessCategory(CaseCategory.SPEC_CLAIM) | ||
.applicant1ProceedWithClaim(YesOrNo.NO) | ||
.build(); | ||
|
||
boolean judicialReferralUtils = JudicialReferralUtils.shouldMoveToJudicialReferral(caseData); | ||
|
||
assertFalse(judicialReferralUtils); | ||
} | ||
|
||
@Test | ||
public void testShouldMoveToJudicialReferralForUnspecClaim() { | ||
CaseData caseData = CaseData.builder() | ||
.caseAccessCategory(CaseCategory.UNSPEC_CLAIM) | ||
.claimValue(ClaimValue.builder() | ||
.statementOfValueInPennies(BigDecimal.valueOf(10000_00)) | ||
.build()) | ||
.applicant1ProceedWithClaim(YesOrNo.YES) | ||
.build(); | ||
|
||
boolean judicialReferralUtils = JudicialReferralUtils.shouldMoveToJudicialReferral(caseData); | ||
assertTrue(judicialReferralUtils); | ||
} | ||
|
||
} |