From 4ced7a526c6b751639c32d656f410889e2c5dda9 Mon Sep 17 00:00:00 2001 From: Marco Villeneuve Date: Mon, 29 Jan 2024 11:09:18 -0800 Subject: [PATCH] Interim commit --- .../service/ResponseFileGeneratorService.java | 4 +- .../PenRequestBatchReportDataMapperTest.java | 44 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/penreg/api/service/ResponseFileGeneratorService.java b/api/src/main/java/ca/bc/gov/educ/penreg/api/service/ResponseFileGeneratorService.java index 2961e3c1..20600b63 100644 --- a/api/src/main/java/ca/bc/gov/educ/penreg/api/service/ResponseFileGeneratorService.java +++ b/api/src/main/java/ca/bc/gov/educ/penreg/api/service/ResponseFileGeneratorService.java @@ -259,7 +259,7 @@ private String createHeader(final PenRequestBatchEntity penRequestBatchEntity, S // retrieved from PEN_COORDINATOR table List schoolContacts = this.getStudentRegistrationContactService().getStudentRegistrationContactsByMincode(penRequestBatchEntity.getMincode()); - var primaryContact = Optional.empty(); + var primaryContact = Optional.ofNullable(SchoolContact.class); if(schoolContacts != null && !schoolContacts.isEmpty()){ primaryContact = Optional.of(schoolContacts.get(0)); } @@ -268,7 +268,7 @@ private String createHeader(final PenRequestBatchEntity penRequestBatchEntity, S .append(String.format("%-8.8s", print(penRequestBatchEntity.getMincode()))) .append(String.format("%-40.40s", print(penRequestBatchEntity.getSchoolName()))) .append(String.format("%-8.8s", penRequestBatchEntity.getProcessDate().format(DateTimeFormatter.ofPattern("yyyyMMdd")))) - .append(String.format("%-100.100s", print(primaryContact.isPresent()? primaryContact.get().getPenCoordinatorEmail() : ""))) + .append(String.format("%-100.100s", print(primaryContact.isPresent()? ((SchoolContact) primaryContact.get()).getEmail() : ""))) .append(String.format("%-10.10s", print(penCoordinator.map(coordinator -> coordinator.getPenCoordinatorFax().replaceAll("[^0-9]+", "")).orElse("")))) .append(String.format("%-40.40s", print(penCoordinator.isPresent()? penCoordinator.get().getPenCoordinatorName() : ""))) .append(" ") diff --git a/api/src/test/java/ca/bc/gov/educ/penreg/api/mapper/v1/PenRequestBatchReportDataMapperTest.java b/api/src/test/java/ca/bc/gov/educ/penreg/api/mapper/v1/PenRequestBatchReportDataMapperTest.java index d5940802..dde2bdeb 100644 --- a/api/src/test/java/ca/bc/gov/educ/penreg/api/mapper/v1/PenRequestBatchReportDataMapperTest.java +++ b/api/src/test/java/ca/bc/gov/educ/penreg/api/mapper/v1/PenRequestBatchReportDataMapperTest.java @@ -180,37 +180,37 @@ public void testToReportUserMatchedListItem_GivenNullValues_ShouldMapSuccessfull assertThat(reportData.getPenCordinatorEmail()).isEqualTo("test@abc.com"); assertThat(reportData.getDiffList().size()).isEqualTo(1); - assertThat(reportData.getDiffList().get(0).getMin().getBirthDate())isEmpty(); - assertThat(reportData.getDiffList().get(0).getMin().getGender())isEmpty(); - assertThat(reportData.getDiffList().get(0).getMin().getGivenName())isEmpty(); - assertThat(reportData.getDiffList().get(0).getMin().getLegalMiddleNames())isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getBirthDate()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getGender()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getGivenName()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getLegalMiddleNames()).isEmpty(); assertThat(reportData.getDiffList().get(0).getMin().getPen()).isEqualTo("123456780"); assertThat(reportData.getDiffList().get(0).getMin().getReason()).isEqualTo(null); - assertThat(reportData.getDiffList().get(0).getMin().getSchoolID())isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getSchoolID()).isEmpty(); assertThat(reportData.getDiffList().get(0).getMin().getSurname()).isEqualTo("BILL"); - assertThat(reportData.getDiffList().get(0).getMin().getUsualName())isEmpty(); + assertThat(reportData.getDiffList().get(0).getMin().getUsualName()).isEmpty(); assertThat(reportData.getDiffList().size()).isEqualTo(1); - assertThat(reportData.getDiffList().get(0).getSchool().getBirthDate())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getGender())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getGivenName())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getLegalMiddleNames())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getPen())isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getBirthDate()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getGender()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getGivenName()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getLegalMiddleNames()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getPen()).isEmpty(); assertThat(reportData.getDiffList().get(0).getSchool().getReason()).isEqualTo(null); - assertThat(reportData.getDiffList().get(0).getSchool().getSchoolID())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getSurname())isEmpty(); - assertThat(reportData.getDiffList().get(0).getSchool().getUsualName())isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getSchoolID()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getSurname()).isEmpty(); + assertThat(reportData.getDiffList().get(0).getSchool().getUsualName()).isEmpty(); assertThat(reportData.getSysMatchedList().size()).isEqualTo(2); - assertThat(reportData.getSysMatchedList().get(1).getBirthDate())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getGender())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getGivenName())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getLegalMiddleNames())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getPen())isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getBirthDate()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getGender()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getGivenName()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getLegalMiddleNames()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getPen()).isEmpty(); assertThat(reportData.getSysMatchedList().get(1).getReason()).isEqualTo(null); - assertThat(reportData.getSysMatchedList().get(1).getSchoolID())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getSurname())isEmpty(); - assertThat(reportData.getSysMatchedList().get(1).getUsualName())isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getSchoolID()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getSurname()).isEmpty(); + assertThat(reportData.getSysMatchedList().get(1).getUsualName()).isEmpty(); assertThat(reportData.getNewPenList().size()).isEqualTo(2); assertThat(reportData.getPendingList().size()).isEqualTo(4);