Skip to content

Commit d5654cb

Browse files
authored
Improve general email unit tests (#2526)
1 parent 6282e02 commit d5654cb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/test/java/uk/gov/hmcts/reform/finrem/caseorchestration/mapper/notificationrequest/FinremNotificationRequestMapperTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.OrganisationPolicy;
2424
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.RepresentationUpdate;
2525
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.RepresentationUpdateHistoryCollection;
26+
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.GeneralEmailWrapper;
2627
import uk.gov.hmcts.reform.finrem.caseorchestration.model.ccd.wrapper.IntervenerOne;
2728
import uk.gov.hmcts.reform.finrem.caseorchestration.model.notification.NotificationRequest;
2829
import uk.gov.hmcts.reform.finrem.caseorchestration.model.wrapper.SolicitorCaseDataKeysWrapper;
@@ -65,13 +66,15 @@ class FinremNotificationRequestMapperTest {
6566
@Mock
6667
ConsentedApplicationHelper consentedApplicationHelper;
6768

68-
private final FinremCaseDetails consentedFinremCaseDetails = getConsentedFinremCaseDetails();
69-
private final FinremCaseDetails contestedFinremCaseDetails = getContestedFinremCaseDetails();
69+
private FinremCaseDetails consentedFinremCaseDetails;
70+
private FinremCaseDetails contestedFinremCaseDetails;
7071

7172
@BeforeEach
7273
void setup() {
7374
// Register the JavaTimeModule for Java 8 Date/Time support
7475
mapper.registerModule(new JavaTimeModule());
76+
consentedFinremCaseDetails = getConsentedFinremCaseDetails();
77+
contestedFinremCaseDetails = getContestedFinremCaseDetails();
7578
}
7679

7780
@Test
@@ -384,13 +387,18 @@ void shouldCreateNotificationRequestForBarristerNotification() {
384387

385388
@Test
386389
void givenContestedCaseData_whenGeneralEmail_thenBuildNotificationRequest() {
390+
String emailBody = "This is a contested case test email";
391+
contestedFinremCaseDetails.getData().setGeneralEmailWrapper(GeneralEmailWrapper.builder()
392+
.generalEmailBody(emailBody)
393+
.build());
387394
NotificationRequest notificationRequest = notificationRequestMapper.getNotificationRequestForGeneralEmail(contestedFinremCaseDetails);
388395

389396
assertEquals("12345", notificationRequest.getCaseReferenceNumber());
390397
assertEquals(TEST_SOLICITOR_REFERENCE, notificationRequest.getSolicitorReferenceNumber());
391398
assertEquals(TEST_DIVORCE_CASE_NUMBER, notificationRequest.getDivorceCaseNumber());
392399
assertEquals(TEST_SOLICITOR_NAME, notificationRequest.getName());
393400
assertEquals(TEST_SOLICITOR_EMAIL, notificationRequest.getNotificationEmail());
401+
assertEquals(emailBody, notificationRequest.getGeneralEmailBody());
394402
assertEquals("contested", notificationRequest.getCaseType());
395403
assertEquals("nottingham", notificationRequest.getSelectedCourt());
396404
assertEquals("David Goodman", notificationRequest.getRespondentName());
@@ -399,13 +407,18 @@ void givenContestedCaseData_whenGeneralEmail_thenBuildNotificationRequest() {
399407

400408
@Test
401409
void givenConsentedCaseData_whenGeneralEmail_thenBuildNotificationRequest() {
410+
String emailBody = "This is a consented case test email";
411+
consentedFinremCaseDetails.getData().setGeneralEmailWrapper(GeneralEmailWrapper.builder()
412+
.generalEmailBody(emailBody)
413+
.build());
402414
NotificationRequest notificationRequest = notificationRequestMapper.getNotificationRequestForGeneralEmail(consentedFinremCaseDetails);
403415

404416
assertEquals("12345", notificationRequest.getCaseReferenceNumber());
405417
assertEquals(TEST_SOLICITOR_REFERENCE, notificationRequest.getSolicitorReferenceNumber());
406418
assertEquals(TEST_DIVORCE_CASE_NUMBER, notificationRequest.getDivorceCaseNumber());
407419
assertEquals(TEST_SOLICITOR_NAME, notificationRequest.getName());
408420
assertEquals(TEST_SOLICITOR_EMAIL, notificationRequest.getNotificationEmail());
421+
assertEquals(emailBody, notificationRequest.getGeneralEmailBody());
409422
assertEquals("consented", notificationRequest.getCaseType());
410423
assertEquals("consent", notificationRequest.getCaseOrderType());
411424
assertEquals("Consent", notificationRequest.getCamelCaseOrderType());

0 commit comments

Comments
 (0)