Skip to content

Commit

Permalink
CIV-11038 LipvsLip mediation csv (#3821)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>

* 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 <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>

* 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 <[email protected]>
Co-authored-by: MMNycz <[email protected]>

* 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 <[email protected]>

* testing master build (#3650)

Co-authored-by: sankhajuria <[email protected]>

---------

Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: Gareth Lancaster <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>
Co-authored-by: jeswanth-hmcts <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>
Co-authored-by: marianadpereira <[email protected]>
Co-authored-by: Manish Garg <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Paul Pearson <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: Harry H <[email protected]>
Co-authored-by: marianadpereira <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>

* 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 <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>

* 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 <[email protected]>
Co-authored-by: MMNycz <[email protected]>

* 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 <[email protected]>

* testing master build (#3650)

Co-authored-by: sankhajuria <[email protected]>

---------

Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>

* 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 <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: Gareth Lancaster <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>
Co-authored-by: jeswanth-hmcts <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>
Co-authored-by: marianadpereira <[email protected]>
Co-authored-by: Manish Garg <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Paul Pearson <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: Harry H <[email protected]>
Co-authored-by: marianadpereira <[email protected]>

* 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 ce3db86.

---------

Co-authored-by: Madhan Mahadevan <[email protected]>
Co-authored-by: vasudevganesanhmcts <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Pijian Liao <[email protected]>
Co-authored-by: pliao-hmcts <[email protected]>

* 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 <[email protected]>
Co-authored-by: Azam <[email protected]>

* CIV-11980 Investigation : Claims missing tasks/role categories (#3811)

* CIV-11980 test caseId

* CIV-8336 fix sonar issue (#3822)

Co-authored-by: Azam <[email protected]>

* 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 <[email protected]>

* CIV-11467 Paragraph 4.1 for claimant LR (#3736)

Co-authored-by: kdaHMCTS <[email protected]>
Co-authored-by: mfallonhmcts <[email protected]>

---------

Co-authored-by: hmcts-version1-ignacio <[email protected]>
Co-authored-by: karthick mohanasundaram <[email protected]>
Co-authored-by: Madhan Mahadevan <[email protected]>
Co-authored-by: vasudevganesanhmcts <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Deepthi Doppalapudi <[email protected]>
Co-authored-by: Pijian Liao <[email protected]>
Co-authored-by: pliao-hmcts <[email protected]>
Co-authored-by: bhagyashreesharma90 <[email protected]>
Co-authored-by: krishnanuthalapati <[email protected]>
Co-authored-by: Azam <[email protected]>
Co-authored-by: UshaPanneerselvam1 <[email protected]>
Co-authored-by: mfallonhmcts <[email protected]>
Co-authored-by: zikrurR <[email protected]>
Co-authored-by: kdaHMCTS <[email protected]>

---------

Co-authored-by: kenneth-hmcts <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: jarekPierchala <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: sankhajuria <[email protected]>
Co-authored-by: hmcts-version1-pablo <[email protected]>
Co-authored-by: Pablo Ortiz <[email protected]>
Co-authored-by: Raja Mani <[email protected]>
Co-authored-by: Gareth Lancaster <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: sankaviv1 <[email protected]>
Co-authored-by: GarethLancaster <[email protected]>
Co-authored-by: douglasrice <[email protected]>
Co-authored-by: jeswanth-hmcts <[email protected]>
Co-authored-by: neeta-hmcts <[email protected]>
Co-authored-by: annika-moorthy <[email protected]>
Co-authored-by: marianadpereira <[email protected]>
Co-authored-by: Manish Garg <[email protected]>
Co-authored-by: MMNycz <[email protected]>
Co-authored-by: Paul Pearson <[email protected]>
Co-authored-by: drummondjm <[email protected]>
Co-authored-by: Astha Malviya <[email protected]>
Co-authored-by: asthamalviya <[email protected]>
Co-authored-by: Harry H <[email protected]>
Co-authored-by: marianadpereira <[email protected]>
Co-authored-by: kenneth-hmcts <[email protected]>
Co-authored-by: jeswanth <[email protected]>
Co-authored-by: hmcts-version1-ignacio <[email protected]>
Co-authored-by: karthick mohanasundaram <[email protected]>
Co-authored-by: Madhan Mahadevan <[email protected]>
Co-authored-by: vasudevganesanhmcts <[email protected]>
Co-authored-by: Deepthi Doppalapudi <[email protected]>
Co-authored-by: Pijian Liao <[email protected]>
Co-authored-by: pliao-hmcts <[email protected]>
Co-authored-by: bhagyashreesharma90 <[email protected]>
Co-authored-by: krishnanuthalapati <[email protected]>
Co-authored-by: Azam <[email protected]>
Co-authored-by: UshaPanneerselvam1 <[email protected]>
Co-authored-by: mfallonhmcts <[email protected]>
Co-authored-by: zikrurR <[email protected]>
Co-authored-by: kdaHMCTS <[email protected]>
  • Loading branch information
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
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
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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]";
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 = "[email protected]";
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,6 +15,7 @@
@SpringBootTest(classes = {
MediationCSVLrvLipService.class,
MediationCSVLrvLrService.class,
MediationCSVLipVLipService.class,
MediationCsvServiceFactory.class
})
public class MediationCSVServiceFactoryTest {
Expand All @@ -24,6 +26,9 @@ public class MediationCSVServiceFactoryTest {
@MockBean
private OrganisationService organisationService;

@MockBean
private FeatureToggleService toggleService;

@Autowired
private MediationCsvServiceFactory mediationCsvServiceFactory;

Expand All @@ -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);
}
}

0 comments on commit 26526ff

Please sign in to comment.