From 26526ff755f8c70639ea929226775de30ac31074 Mon Sep 17 00:00:00 2001 From: kalachandrasekar1 <114995593+kalachandrasekar1@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:23:17 +0000 Subject: [PATCH] CIV-11038 LipvsLip mediation csv (#3821) * CIV-11038 changes * CIV-11545 changes * CIV-11542 changes * CIV-11542 changes * CIV-11542 checkstyle fixed * CIV-11603 Fast Track Claimant Intent (#3720) * CIV-11571 Fix court location if no specific court (#3569) * CIV-11571: Add null checking * CIV-11571: Add unit test --------- Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-8241 Manual Determination - Lip Notifications (#3529) * added changes for claimant response cui event. * CIV-8291 : Functional code - Need to refactor * CIV-8291 : Refactor duplicated methods to a common service * CIV-8291 : Handler Test * CIV-8291 : Fix checkStyle * CIV-8291 : Fix checkStyle * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Change final state to PROCEEDS_IN_HERITAGE_SYSTEM * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification Test * CIV-8241: Set Up Notification Test * CIV-8241: Roll back one line * CIV-8241: Change method name * Update build.gradle * Update build.gradle --------- Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-10727 Assisted order uplift (#3550) * CIV-11158 Save hearing location in case data * Added setting assisted order courtLocation to hearingLocation or caseManagementLocation is hearingLocation is not defined * Fixed not filtering courtLocations by caseTypeId --------- Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice * CIV-11695 - Update ClaimantResponseCuiCallbackHandler.java (#3616) * Update ClaimantResponseCuiCallbackHandler.java * fix for judicial referral * fixed claim state issue and unit tests. --------- Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: Pablo Ortiz Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> * CIV-8905 Claimant Dashboard Status "Mediation E2E, Manual Determination (org), ITP failed" (#3564) * CIV-8905 Added functionality for dashboard status * CIV-8905 Added functionality for dashboard status * CIV-8905 Fixed AC 4 * CIV-11363 add trigger event (#3633) * CIV-11363 add trigger event * CIV-8905 Merged with bulk_tasks --------- Co-authored-by: Pablo Ortiz Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> * CIV-8454 Trigger service request after CCD case creation (#3597) * CIV-8454 Trigger service request after CCD case creation * CIV-8454 Move Service Request creation to Camunda * CIV-8454 Undo flow state change - not required * CIV-8454 Remove empty lines * CIV-8454 Add test for service request handler CUI * CIV-8454 Only create service request when no help with fees * CIV-8454 Change event name * CIV-11144 updated witness summary to add date (#3623) * updated witness summary to add date * Update Jenkinsfile_CNP point at CCD * Update Jenkinsfile_CNP * CIV-11363 add caseId to caseIdForRetrigger.txt (#3646) * CIV-11363 add caseId to caseIdForRetrigger.txt * adding not suitable for sdo too * update caseIdForRetriger --------- Co-authored-by: Astha Malviya * testing master build (#3650) Co-authored-by: sankhajuria --------- Co-authored-by: Raja Mani Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: sankhajuria Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-11603 Set Up Case State * CIV-11603 Set Up Translation * CIV-11603 Update Mediation Check * CIV-11603 Remove unused import * CIV-11603 Update Unit Test * CIV-11603 Adding more unit test * CIV-11603 Update from review * CIV-11603 Merged with master --------- Co-authored-by: jarekPierchala Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: Gareth Lancaster <90632240+Gareth40343@users.noreply.github.com> Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice Co-authored-by: jeswanth-hmcts <134285996+jeswanth-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> Co-authored-by: marianadpereira Co-authored-by: Manish Garg Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Paul Pearson <46532983+paul-pearson@users.noreply.github.com> Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: Harry H <33700332+HarryH96@users.noreply.github.com> Co-authored-by: marianadpereira <71711509+marianadpereira@users.noreply.github.com> * CIV-11038 changes * CIV-11038 changes * CIV-11038 removed space * CIV-11603 Fast Track Claimant Intent (#3720) * CIV-11571 Fix court location if no specific court (#3569) * CIV-11571: Add null checking * CIV-11571: Add unit test --------- Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-8241 Manual Determination - Lip Notifications (#3529) * added changes for claimant response cui event. * CIV-8291 : Functional code - Need to refactor * CIV-8291 : Refactor duplicated methods to a common service * CIV-8291 : Handler Test * CIV-8291 : Fix checkStyle * CIV-8291 : Fix checkStyle * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Adding mocks * CIV-8291 : Change final state to PROCEEDS_IN_HERITAGE_SYSTEM * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8291 : Dev comments * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification * CIV-8241: Set Up Notification Test * CIV-8241: Set Up Notification Test * CIV-8241: Roll back one line * CIV-8241: Change method name * Update build.gradle * Update build.gradle --------- Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-10727 Assisted order uplift (#3550) * CIV-11158 Save hearing location in case data * Added setting assisted order courtLocation to hearingLocation or caseManagementLocation is hearingLocation is not defined * Fixed not filtering courtLocations by caseTypeId --------- Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice * CIV-11695 - Update ClaimantResponseCuiCallbackHandler.java (#3616) * Update ClaimantResponseCuiCallbackHandler.java * fix for judicial referral * fixed claim state issue and unit tests. --------- Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: Pablo Ortiz Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> * CIV-8905 Claimant Dashboard Status "Mediation E2E, Manual Determination (org), ITP failed" (#3564) * CIV-8905 Added functionality for dashboard status * CIV-8905 Added functionality for dashboard status * CIV-8905 Fixed AC 4 * CIV-11363 add trigger event (#3633) * CIV-11363 add trigger event * CIV-8905 Merged with bulk_tasks --------- Co-authored-by: Pablo Ortiz Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> * CIV-8454 Trigger service request after CCD case creation (#3597) * CIV-8454 Trigger service request after CCD case creation * CIV-8454 Move Service Request creation to Camunda * CIV-8454 Undo flow state change - not required * CIV-8454 Remove empty lines * CIV-8454 Add test for service request handler CUI * CIV-8454 Only create service request when no help with fees * CIV-8454 Change event name * CIV-11144 updated witness summary to add date (#3623) * updated witness summary to add date * Update Jenkinsfile_CNP point at CCD * Update Jenkinsfile_CNP * CIV-11363 add caseId to caseIdForRetrigger.txt (#3646) * CIV-11363 add caseId to caseIdForRetrigger.txt * adding not suitable for sdo too * update caseIdForRetriger --------- Co-authored-by: Astha Malviya * testing master build (#3650) Co-authored-by: sankhajuria --------- Co-authored-by: Raja Mani Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: sankhajuria Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> * CIV-11603 Set Up Case State * CIV-11603 Set Up Translation * CIV-11603 Update Mediation Check * CIV-11603 Remove unused import * CIV-11603 Update Unit Test * CIV-11603 Adding more unit test * CIV-11603 Update from review * CIV-11603 Merged with master --------- Co-authored-by: jarekPierchala Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: Gareth Lancaster <90632240+Gareth40343@users.noreply.github.com> Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice Co-authored-by: jeswanth-hmcts <134285996+jeswanth-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> Co-authored-by: marianadpereira Co-authored-by: Manish Garg Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Paul Pearson <46532983+paul-pearson@users.noreply.github.com> Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: Harry H <33700332+HarryH96@users.noreply.github.com> Co-authored-by: marianadpereira <71711509+marianadpereira@users.noreply.github.com> * CIV-0000 Update from master * CIV-11699 added organisation policy for triggering NOC (#3795) * CIV-11699 added organisation policy for triggering NOC * CIV-8334 fast track noise induced hearing (#3780) * CIV-8334 set allocatedTrack to fast track in case it's NIHL * CIV-8334 AllocatedTrack refactor * CIV-8334 AllocatedTrack refactor * CIV-8334 AllocatedTrack refactor * CIV-11935 Content Changes - Make Application (#3768) * CIV-11935 Content Changes - Make Application * Revert Enum code * Revert "Revert Enum code" This reverts commit ce3db8627bc52f71ccda5ae011aa5e4cfa080329. --------- Co-authored-by: Madhan Mahadevan Co-authored-by: vasudevganesanhmcts <100689363+vasudevganesanhmcts@users.noreply.github.com> * CIV-0000 1v2DS response type is null when Respondent 1 is not represented (#3810) * 1v2DS response type is null when resp 1 is not represented * CIV-11980 test caseId * adding logs for take case offline scheduler --------- Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> * CIV-10338 Added condition to check regions for Early Adaptors for General Apps (#3604) * CIV-10338 Added condition to check regions for Early Adaptors * CIV-10338 revert perf change 1 step for setresp --------- Co-authored-by: vasudevganesanhmcts <100689363+vasudevganesanhmcts@users.noreply.github.com> Co-authored-by: Pijian Liao Co-authored-by: pliao-hmcts <113367232+pliao-hmcts@users.noreply.github.com> * CIV-8336 Judge decision to reconsider request changes (#3790) * CIV-8336 Judge decision to reconsider request changes * CIV-8336 fix checkstyle * Update JudgeDecisionOnReconsiderationRequestCallbackHandler.java * Update JudgeDecisionOnReconsiderationRequestCallbackHandlerTest.java --------- Co-authored-by: krishnanuthalapati <32389208+krishnanuthalapati@users.noreply.github.com> Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> * CIV-11980 Investigation : Claims missing tasks/role categories (#3811) * CIV-11980 test caseId * CIV-8336 fix sonar issue (#3822) Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> * CIV-11937 Update GA Doc template (#3793) * CIV-11937 Update GA Doc template * Update GA Judicial doc template * CIV-11862 Remove Damages form from LR vs LiP claim forms (#3762) * CIV-11862 Remove Damages form from LR vs LiP claim forms * CIV-11862 Remove Damages form from LR vs LiP claim forms --------- Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com> * CIV-11467 Paragraph 4.1 for claimant LR (#3736) Co-authored-by: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com> Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com> --------- Co-authored-by: hmcts-version1-ignacio <107860328+hmcts-version1-ignacio@users.noreply.github.com> Co-authored-by: karthick mohanasundaram <92928238+karthick-mohanasundaram-HMCTS@users.noreply.github.com> Co-authored-by: Madhan Mahadevan Co-authored-by: vasudevganesanhmcts <100689363+vasudevganesanhmcts@users.noreply.github.com> Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Deepthi Doppalapudi <107422736+deepthidoppalapudihmcts@users.noreply.github.com> Co-authored-by: Pijian Liao Co-authored-by: pliao-hmcts <113367232+pliao-hmcts@users.noreply.github.com> Co-authored-by: bhagyashreesharma90 <114094319+bhagyashreesharma90@users.noreply.github.com> Co-authored-by: krishnanuthalapati <32389208+krishnanuthalapati@users.noreply.github.com> Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> Co-authored-by: UshaPanneerselvam1 <122611188+UshaPanneerselvam1@users.noreply.github.com> Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com> Co-authored-by: zikrurR Co-authored-by: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com> --------- Co-authored-by: kenneth-hmcts <91327278+kenneth-hmcts@users.noreply.github.com> Co-authored-by: jarekPierchala Co-authored-by: jarekPierchala <118526007+jarekPierchala@users.noreply.github.com> Co-authored-by: neeta-hmcts Co-authored-by: sankhajuria Co-authored-by: hmcts-version1-pablo <107927784+hmcts-version1-pablo@users.noreply.github.com> Co-authored-by: Pablo Ortiz Co-authored-by: Raja Mani Co-authored-by: Gareth Lancaster <90632240+Gareth40343@users.noreply.github.com> Co-authored-by: sankaviv1 Co-authored-by: sankaviv1 <95748224+sankaviv1@users.noreply.github.com> Co-authored-by: GarethLancaster <31533575+Gareth40342@users.noreply.github.com> Co-authored-by: douglasrice Co-authored-by: jeswanth-hmcts <134285996+jeswanth-hmcts@users.noreply.github.com> Co-authored-by: neeta-hmcts <115545612+neeta-hmcts@users.noreply.github.com> Co-authored-by: annika-moorthy <85934693+annika-moorthy@users.noreply.github.com> Co-authored-by: marianadpereira Co-authored-by: Manish Garg Co-authored-by: MMNycz <94067802+MMNycz@users.noreply.github.com> Co-authored-by: Paul Pearson <46532983+paul-pearson@users.noreply.github.com> Co-authored-by: drummondjm <93932689+drummondjm@users.noreply.github.com> Co-authored-by: Astha Malviya Co-authored-by: asthamalviya <104994907+asthamalviya@users.noreply.github.com> Co-authored-by: Harry H <33700332+HarryH96@users.noreply.github.com> Co-authored-by: marianadpereira <71711509+marianadpereira@users.noreply.github.com> Co-authored-by: kenneth-hmcts Co-authored-by: jeswanth Co-authored-by: hmcts-version1-ignacio <107860328+hmcts-version1-ignacio@users.noreply.github.com> Co-authored-by: karthick mohanasundaram <92928238+karthick-mohanasundaram-HMCTS@users.noreply.github.com> Co-authored-by: Madhan Mahadevan Co-authored-by: vasudevganesanhmcts <100689363+vasudevganesanhmcts@users.noreply.github.com> Co-authored-by: Deepthi Doppalapudi <107422736+deepthidoppalapudihmcts@users.noreply.github.com> Co-authored-by: Pijian Liao Co-authored-by: pliao-hmcts <113367232+pliao-hmcts@users.noreply.github.com> Co-authored-by: bhagyashreesharma90 <114094319+bhagyashreesharma90@users.noreply.github.com> Co-authored-by: krishnanuthalapati <32389208+krishnanuthalapati@users.noreply.github.com> Co-authored-by: Azam <106387766+Azam-Hmcts@users.noreply.github.com> Co-authored-by: UshaPanneerselvam1 <122611188+UshaPanneerselvam1@users.noreply.github.com> Co-authored-by: mfallonhmcts <114912573+mfallonhmcts@users.noreply.github.com> Co-authored-by: zikrurR Co-authored-by: kdaHMCTS <128375235+kdaHMCTS@users.noreply.github.com> --- .../mediation/LipApplicantContactDetails.java | 19 ++ .../mediation/MediationCSVLipVLipService.java | 27 +++ .../mediation/MediationCsvServiceFactory.java | 7 +- .../MediationCSVLipVLipServiceTest.java | 166 ++++++++++++++++++ .../MediationCSVServiceFactoryTest.java | 17 ++ 5 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 src/main/java/uk/gov/hmcts/reform/civil/service/mediation/LipApplicantContactDetails.java create mode 100644 src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipService.java create mode 100644 src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipServiceTest.java diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/LipApplicantContactDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/LipApplicantContactDetails.java new file mode 100644 index 00000000000..0d07203bef1 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/LipApplicantContactDetails.java @@ -0,0 +1,19 @@ +package uk.gov.hmcts.reform.civil.service.mediation; + +public class LipApplicantContactDetails extends LipContactDetails implements ApplicantContactDetails { + + @Override + public String getApplicantContactName(MediationParams params) { + return getCsvIndividualName(params.getCaseData().getApplicant1()); + } + + @Override + public String getApplicantContactNumber(MediationParams params) { + return params.getCaseData().getApplicant1().getPartyPhone(); + } + + @Override + public String getApplicantContactEmail(MediationParams params) { + return params.getCaseData().getApplicant1Email(); + } +} diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipService.java new file mode 100644 index 00000000000..f6d71cf5243 --- /dev/null +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipService.java @@ -0,0 +1,27 @@ +package uk.gov.hmcts.reform.civil.service.mediation; + +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; +import uk.gov.hmcts.reform.civil.model.CaseData; + +@Service +@AllArgsConstructor +public class MediationCSVLipVLipService extends MediationCSVService { + + @Override + protected ApplicantContactDetails getApplicantContactDetails() { + return new LipApplicantContactDetails(); + } + + @Override + protected DefendantContactDetails getDefendantContactDetails() { + return new LipDefendantContactDetails(); + } + + @Override + protected MediationParams getMediationParams(CaseData caseData) { + return MediationParams.builder() + .caseData(caseData) + .build(); + } +} diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCsvServiceFactory.java b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCsvServiceFactory.java index e9ddc527dfd..323361210ee 100644 --- a/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCsvServiceFactory.java +++ b/src/main/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCsvServiceFactory.java @@ -3,6 +3,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.service.FeatureToggleService; @Service @RequiredArgsConstructor @@ -10,10 +11,14 @@ public class MediationCsvServiceFactory { private final MediationCSVLrvLrService mediationServiceLrvLr; private final MediationCSVLrvLipService mediationCSVLrvLipService; + private final MediationCSVLipVLipService mediationCSVLipVLipService; + private final FeatureToggleService toggleService; public MediationCSVService getMediationCSVService(CaseData caseData) { - if (caseData.isRespondent1LiP()) { + if (caseData.isRespondent1LiP() && !caseData.isApplicantLiP()) { return mediationCSVLrvLipService; + } else if (caseData.isApplicantLiP() && toggleService.isLipVLipEnabled()) { + return mediationCSVLipVLipService; } return mediationServiceLrvLr; } diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipServiceTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipServiceTest.java new file mode 100644 index 00000000000..7b2e7253f24 --- /dev/null +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVLipVLipServiceTest.java @@ -0,0 +1,166 @@ +package uk.gov.hmcts.reform.civil.service.mediation; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.model.Party; + +import java.math.BigDecimal; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +@SpringBootTest(classes = { + MediationCSVLipVLipService.class +}) +public class MediationCSVLipVLipServiceTest { + + private static final String APPLICANT_COMPANY_NAME = "Applicant company name"; + private static final String APPLICANT_ORGANISATION_NAME = "Applicant organisation name"; + private static final String APPLICANT_EMAIL_ADDRESS = "Applicant@company.com"; + private static final String APPLICANT_PHONE_NUMBER = "7553072111"; + private static final String APPLICANT_INDIVIDUAL_FIST_NAME = "Applicant Individual First Name"; + private static final String APPLICANT_INDIVIDUAL_LAST_NAME = "Applicant Individual Last Name"; + private static final String APPLICANT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME = "Applicant Sole Trader First Name"; + private static final String APPLICANT_INDIVIDUAL_SOLE_TRADER_LAST_NAME = "Applicant Sole Trader Last Name"; + private static final String RESPONDENT_COMPANY_NAME = "Respondent company name"; + private static final String RESPONDENT_ORGANISATION_NAME = "Respondent organisation name"; + private static final String RESPONDENT_EMAIL_ADDRESS = "respondent@company.com"; + private static final String RESPONDENT_PHONE_NUMBER = "0022002200"; + private static final String RESPONDENT_INDIVIDUAL_FIST_NAME = "Respondent Individual First Name"; + private static final String RESPONDENT_INDIVIDUAL_LAST_NAME = "Respondent Individual Last Name"; + private static final String RESPONDENT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME = "Respondent Sole Trader First Name"; + private static final String RESPONDENT_INDIVIDUAL_SOLE_TRADER_LAST_NAME = "Respondent Sole Trader Last Name"; + private static final String TOTAL_AMOUNT = "9000"; + private static final String ID = "123456789"; + private static final String RESPONDENT = "2"; + private static final String APPLICANT = "1"; + + @Autowired + private MediationCSVLipVLipService service; + + @Test + void shouldReturn_properDataForFile_ForIndividual() { + //Given + CaseData caseData = getCaseData(Party.Type.INDIVIDUAL); + //When + String result = service.generateCSVContent(caseData); + //Then + assertThat(result).contains(ID); + assertThat(result).contains(APPLICANT); + assertThat(result).contains(APPLICANT_INDIVIDUAL_FIST_NAME + " " + APPLICANT_INDIVIDUAL_LAST_NAME); + assertThat(result).contains(APPLICANT_PHONE_NUMBER); + assertThat(result).contains(APPLICANT_EMAIL_ADDRESS); + assertThat(result).contains(RESPONDENT); + assertThat(result).contains(RESPONDENT_INDIVIDUAL_FIST_NAME + " " + RESPONDENT_INDIVIDUAL_LAST_NAME); + assertThat(result).contains(TOTAL_AMOUNT); + assertThat(result).contains(RESPONDENT_PHONE_NUMBER); + assertThat(result).contains(RESPONDENT_EMAIL_ADDRESS); + } + + @Test + void shouldReturn_properDataForFile_ForCompany() { + //Given + CaseData caseData = getCaseData(Party.Type.COMPANY); + //When + String result = service.generateCSVContent(caseData); + //Then + assertThat(result).contains(ID); + assertThat(result).contains(APPLICANT); + assertThat(result).contains(APPLICANT_COMPANY_NAME); + assertThat(result).contains(APPLICANT_PHONE_NUMBER); + assertThat(result).contains(APPLICANT_EMAIL_ADDRESS); + assertThat(result).contains(RESPONDENT); + assertThat(result).contains(RESPONDENT_COMPANY_NAME); + assertThat(result).contains(TOTAL_AMOUNT); + assertThat(result).contains(RESPONDENT_PHONE_NUMBER); + assertThat(result).contains(RESPONDENT_EMAIL_ADDRESS); + } + + @Test + void shouldReturn_properDataForFile_ForOrganisation() { + //Given + CaseData caseData = getCaseData(Party.Type.ORGANISATION); + //When + String result = service.generateCSVContent(caseData); + //Then + assertThat(result).contains(ID); + assertThat(result).contains(APPLICANT); + assertThat(result).contains(APPLICANT_ORGANISATION_NAME); + assertThat(result).contains(APPLICANT_PHONE_NUMBER); + assertThat(result).contains(APPLICANT_EMAIL_ADDRESS); + assertThat(result).contains(RESPONDENT); + assertThat(result).contains(RESPONDENT_ORGANISATION_NAME); + assertThat(result).contains(TOTAL_AMOUNT); + assertThat(result).contains(RESPONDENT_PHONE_NUMBER); + assertThat(result).contains(RESPONDENT_EMAIL_ADDRESS); + } + + @Test + void shouldReturn_properDataForFile_ForSoleTrader() { + //Given + CaseData caseData = getCaseData(Party.Type.SOLE_TRADER); + //When + String result = service.generateCSVContent(caseData); + //Then + assertThat(result).contains(ID); + assertThat(result).contains(APPLICANT); + assertThat(result).contains(APPLICANT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME + " " + APPLICANT_INDIVIDUAL_SOLE_TRADER_LAST_NAME); + assertThat(result).contains(APPLICANT_PHONE_NUMBER); + assertThat(result).contains(APPLICANT_EMAIL_ADDRESS); + assertThat(result).contains(RESPONDENT); + assertThat(result).contains(RESPONDENT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME + " " + RESPONDENT_INDIVIDUAL_SOLE_TRADER_LAST_NAME); + assertThat(result).contains(TOTAL_AMOUNT); + assertThat(result).contains(RESPONDENT_PHONE_NUMBER); + assertThat(result).contains(RESPONDENT_EMAIL_ADDRESS); + } + + @Test + void shouldReturn_properDataForFile_ForBilingualFlag() { + //Given + CaseData caseData = getCaseData(Party.Type.SOLE_TRADER); + //When + String result = service.generateCSVContent(caseData); + //Then + assertThat(result).contains(ID); + assertThat(result).contains(APPLICANT); + assertThat(result).contains(APPLICANT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME + " " + APPLICANT_INDIVIDUAL_SOLE_TRADER_LAST_NAME); + assertThat(result).contains(APPLICANT_PHONE_NUMBER); + assertThat(result).contains(APPLICANT_EMAIL_ADDRESS); + assertThat(result).contains(RESPONDENT); + assertThat(result).contains(RESPONDENT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME + " " + RESPONDENT_INDIVIDUAL_SOLE_TRADER_LAST_NAME); + assertThat(result).contains(TOTAL_AMOUNT); + assertThat(result).contains(RESPONDENT_PHONE_NUMBER); + assertThat(result).contains(RESPONDENT_EMAIL_ADDRESS); + } + + private CaseData getCaseData(Party.Type partyType) { + CaseData caseData = CaseData.builder() + .legacyCaseReference(ID) + .totalClaimAmount(new BigDecimal(9000)) + .applicant1(Party.builder() + .type(partyType) + .companyName(APPLICANT_COMPANY_NAME) + .partyPhone(APPLICANT_PHONE_NUMBER) + .partyEmail(APPLICANT_EMAIL_ADDRESS) + .individualFirstName(APPLICANT_INDIVIDUAL_FIST_NAME) + .individualLastName(APPLICANT_INDIVIDUAL_LAST_NAME) + .soleTraderFirstName(APPLICANT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME) + .soleTraderLastName(APPLICANT_INDIVIDUAL_SOLE_TRADER_LAST_NAME) + .organisationName(APPLICANT_ORGANISATION_NAME) + .build()) + .respondent1(Party.builder() + .type(partyType) + .soleTraderFirstName(RESPONDENT_INDIVIDUAL_SOLE_TRADER_FIRST_NAME) + .soleTraderLastName(RESPONDENT_INDIVIDUAL_SOLE_TRADER_LAST_NAME) + .individualFirstName(RESPONDENT_INDIVIDUAL_FIST_NAME) + .individualLastName(RESPONDENT_INDIVIDUAL_LAST_NAME) + .companyName(RESPONDENT_COMPANY_NAME) + .organisationName(RESPONDENT_ORGANISATION_NAME) + .partyPhone(RESPONDENT_PHONE_NUMBER) + .partyEmail(RESPONDENT_EMAIL_ADDRESS) + .build()) + .build(); + return caseData; + } +} \ No newline at end of file diff --git a/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVServiceFactoryTest.java b/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVServiceFactoryTest.java index 611e6dfaec8..ccdb35b0156 100644 --- a/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVServiceFactoryTest.java +++ b/src/test/java/uk/gov/hmcts/reform/civil/service/mediation/MediationCSVServiceFactoryTest.java @@ -6,6 +6,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import uk.gov.hmcts.reform.civil.model.CaseData; +import uk.gov.hmcts.reform.civil.service.FeatureToggleService; import uk.gov.hmcts.reform.civil.service.OrganisationService; import static org.assertj.core.api.Assertions.assertThat; @@ -14,6 +15,7 @@ @SpringBootTest(classes = { MediationCSVLrvLipService.class, MediationCSVLrvLrService.class, + MediationCSVLipVLipService.class, MediationCsvServiceFactory.class }) public class MediationCSVServiceFactoryTest { @@ -24,6 +26,9 @@ public class MediationCSVServiceFactoryTest { @MockBean private OrganisationService organisationService; + @MockBean + private FeatureToggleService toggleService; + @Autowired private MediationCsvServiceFactory mediationCsvServiceFactory; @@ -46,4 +51,16 @@ void shouldReturnMediationCSVLrvLip_whenDefendantLip() { //Then assertThat(mediationCSVService).isInstanceOf(MediationCSVLrvLipService.class); } + + @Test + void shouldReturnMediationCSVLipVLip_whenApplicantLip() { + //Given + given(toggleService.isLipVLipEnabled()).willReturn(true); + given(caseData.isApplicantLiP()).willReturn(true); + //When + MediationCSVService mediationCSVService = mediationCsvServiceFactory.getMediationCSVService(caseData); + //Then + assertThat(mediationCSVService).isInstanceOf(MediationCSVLipVLipService.class); + } } +