diff --git a/api/src/main/java/ca/bc/gov/educ/api/institute/constants/v1/Constants.java b/api/src/main/java/ca/bc/gov/educ/api/institute/constants/v1/Constants.java index 33fc65dd..fe1ecf78 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/institute/constants/v1/Constants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/institute/constants/v1/Constants.java @@ -17,5 +17,7 @@ private Constants() {} public static final String UPPERBOUND = "999"; public static final String DEFAULTNUMBER = "000"; public static final String INDEPENDENT="INDEPEND"; + public static final String OFFSHORE="OFFSHORE"; public static final String NONINDEPENDENT="FED_BAND"; + public static final String INDEPENDENTFNS="INDP_FNS"; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/institute/service/v1/SchoolService.java b/api/src/main/java/ca/bc/gov/educ/api/institute/service/v1/SchoolService.java index 292ee25c..66e747f3 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/institute/service/v1/SchoolService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/institute/service/v1/SchoolService.java @@ -452,7 +452,9 @@ private SchoolEntity moveSchoolHelper(School school, School existingSchool) { school.getSchoolNumber(), UUID.fromString(school.getDistrictId())); if(school.getSchoolCategoryCode().equals(existingSchool.getSchoolCategoryCode()) && - !school.getSchoolCategoryCode().equals(Constants.INDEPENDENT) && !school.getSchoolCategoryCode().equals(Constants.NONINDEPENDENT) && schools.isEmpty()) { + !school.getSchoolCategoryCode().equals(Constants.INDEPENDENT) && !school.getSchoolCategoryCode().equals(Constants.NONINDEPENDENT) + && !school.getSchoolCategoryCode().equals(Constants.INDEPENDENTFNS) && !school.getSchoolCategoryCode().equals(Constants.OFFSHORE) + && schools.isEmpty()) { schoolEntity.setSchoolNumber(school.getSchoolNumber()); } else { schoolEntity.setSchoolNumber( diff --git a/api/src/test/java/ca/bc/gov/educ/api/institute/service/EventHandlerServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/institute/service/EventHandlerServiceTest.java index f54058c1..649bcc64 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/institute/service/EventHandlerServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/institute/service/EventHandlerServiceTest.java @@ -330,6 +330,310 @@ public void testHandleEvent_givenEventTypeMOVE_SCHOOL__DoesExistAndSynchronousNa assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); } + @Test + public void testHandleEvent_givenEventTypeMOVE_SCHOOL_whereSchoolNumberInNewDistrictIsAvailable__DoesExistAndSynchronousNatsMessage_shouldRespondWithDataAndCreateMoveHistory() throws IOException, ExecutionException, InterruptedException { + final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData()); + SchoolEntity toSchoolEntity = this.createNewSchoolData("99000", "PUBLIC", "DISTONLINE"); + SchoolEntity fromSchoolEntity = this.createNewSchoolData("99100", "PUBLIC", "DISTONLINE"); + LocalDateTime moveDate = LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MILLIS); + + Set schoolAddressSet = new HashSet<>(); + SchoolAddressEntity fromSchoolAddressEntity = SchoolAddressEntity.builder() + .addressTypeCode("MAILING").addressLine1("123 This Street").city("Victoria") + .provinceCode("BC").countryCode("CA").postal("V1V2V3").schoolEntity(fromSchoolEntity).build(); + schoolAddressSet.add(fromSchoolAddressEntity); + + toSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setAddresses(schoolAddressSet); + schoolRepository.save(fromSchoolEntity); + + School toSchool = new School(); + SchoolMapper map = SchoolMapper.mapper; + + BeanUtils.copyProperties(map.toStructure(toSchoolEntity), toSchool); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + MoveSchoolData moveSchoolData = createMoveSchoolData(toSchool, fromSchoolEntity.getSchoolId(), moveDate); + + UUID sagaId = UUID.randomUUID(); + final Event event = Event.builder().eventType(MOVE_SCHOOL).sagaId(sagaId).eventPayload(objectMapper.writeValueAsString(moveSchoolData)).build(); + + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + Optional schoolUpdatedEvent = instituteEventRepository.findBySagaIdAndEventType(sagaId, MOVE_SCHOOL.toString()); + assertThat(schoolUpdatedEvent).isPresent(); + assertThat(schoolUpdatedEvent.get().getEventStatus()).isEqualTo(MESSAGE_PUBLISHED.toString()); + assertThat(schoolUpdatedEvent.get().getEventOutcome()).isEqualTo(SCHOOL_MOVED.toString()); + + //check that data in event payload is updated + MoveSchoolData moveSchoolEventData = JsonUtil.getJsonObjectFromString(MoveSchoolData.class, event.getEventPayload()); + assertThat(moveSchoolEventData.getToSchool().getSchoolId()).isNotNull(); + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).isEqualTo("99000"); //new school number since school number already exists in district + + //2 schools = 1 that was created + 1 that was closed for the move. + assertThat(schoolRepository.findAll()).hasSize(2); + + //confirm that running the same event twice will not create a new school. + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + assertThat(schoolRepository.findAll()).hasSize(2); + + SchoolEntity fromSchoolEntityComplete = schoolRepository.findById(fromSchoolEntity.getSchoolId()).orElseThrow(); + SchoolEntity toSchoolEntityComplete = schoolRepository.findById(UUID.fromString(moveSchoolEventData.getToSchool().getSchoolId())).orElseThrow(); + + //confirm previous school has closed and address information saved + assertThat(fromSchoolEntityComplete.getClosedDate()).isEqualTo(moveDate); + assertThat(fromSchoolEntityComplete.getAddresses().stream().toList().get(0).getCity()).isEqualTo(fromSchoolAddressEntity.getCity()); + + assertThat(fromSchoolEntityComplete.getSchoolMoveTo().stream().toList().get(0).getToSchoolId()).isEqualTo(toSchoolEntityComplete.getSchoolId()); + assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); + } + + @Test + public void testHandleEvent_givenEventTypeMOVE_SCHOOL_withNewSchoolCategory__DoesExistAndSynchronousNatsMessage_shouldRespondWithDataAndCreateMoveHistory() throws IOException, ExecutionException, InterruptedException { + final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData()); + SchoolEntity toSchoolEntity = this.createNewSchoolData("99000", "EAR_LEARN", "STRONG_CEN"); + SchoolEntity fromSchoolEntity = this.createNewSchoolData("99100", "PUBLIC", "DISTONLINE"); + LocalDateTime moveDate = LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MILLIS); + + Set schoolAddressSet = new HashSet<>(); + SchoolAddressEntity fromSchoolAddressEntity = SchoolAddressEntity.builder() + .addressTypeCode("MAILING").addressLine1("123 This Street").city("Victoria") + .provinceCode("BC").countryCode("CA").postal("V1V2V3").schoolEntity(fromSchoolEntity).build(); + schoolAddressSet.add(fromSchoolAddressEntity); + + toSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setAddresses(schoolAddressSet); + schoolRepository.save(fromSchoolEntity); + + School toSchool = new School(); + SchoolMapper map = SchoolMapper.mapper; + + BeanUtils.copyProperties(map.toStructure(toSchoolEntity), toSchool); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + MoveSchoolData moveSchoolData = createMoveSchoolData(toSchool, fromSchoolEntity.getSchoolId(), moveDate); + + UUID sagaId = UUID.randomUUID(); + final Event event = Event.builder().eventType(MOVE_SCHOOL).sagaId(sagaId).eventPayload(objectMapper.writeValueAsString(moveSchoolData)).build(); + + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + Optional schoolUpdatedEvent = instituteEventRepository.findBySagaIdAndEventType(sagaId, MOVE_SCHOOL.toString()); + assertThat(schoolUpdatedEvent).isPresent(); + assertThat(schoolUpdatedEvent.get().getEventStatus()).isEqualTo(MESSAGE_PUBLISHED.toString()); + assertThat(schoolUpdatedEvent.get().getEventOutcome()).isEqualTo(SCHOOL_MOVED.toString()); + + //check that data in event payload is updated + MoveSchoolData moveSchoolEventData = JsonUtil.getJsonObjectFromString(MoveSchoolData.class, event.getEventPayload()); + assertThat(moveSchoolEventData.getToSchool().getSchoolId()).isNotNull(); + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).isNotEqualTo("99000"); //new school number since school number already exists in district + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).startsWith("25"); + + //2 schools = 1 that was created + 1 that was closed for the move. + assertThat(schoolRepository.findAll()).hasSize(2); + + //confirm that running the same event twice will not create a new school. + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + assertThat(schoolRepository.findAll()).hasSize(2); + + SchoolEntity fromSchoolEntityComplete = schoolRepository.findById(fromSchoolEntity.getSchoolId()).orElseThrow(); + SchoolEntity toSchoolEntityComplete = schoolRepository.findById(UUID.fromString(moveSchoolEventData.getToSchool().getSchoolId())).orElseThrow(); + + //confirm previous school has closed and address information saved + assertThat(fromSchoolEntityComplete.getClosedDate()).isEqualTo(moveDate); + assertThat(fromSchoolEntityComplete.getAddresses().stream().toList().get(0).getCity()).isEqualTo(fromSchoolAddressEntity.getCity()); + + assertThat(fromSchoolEntityComplete.getSchoolMoveTo().stream().toList().get(0).getToSchoolId()).isEqualTo(toSchoolEntityComplete.getSchoolId()); + assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); + } + + @Test + public void testHandleEvent_givenEventTypeMOVE_SCHOOL_withIndependentSchoolCategory__DoesExistAndSynchronousNatsMessage_shouldRespondWithDataAndCreateMoveHistory() throws IOException, ExecutionException, InterruptedException { + final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData()); + SchoolEntity toSchoolEntity = this.createNewSchoolData("96100", "INDEPEND", "STANDARD"); + SchoolEntity fromSchoolEntity = this.createNewSchoolData("96100", "INDEPEND", "STANDARD"); + LocalDateTime moveDate = LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MILLIS); + + Set schoolAddressSet = new HashSet<>(); + SchoolAddressEntity fromSchoolAddressEntity = SchoolAddressEntity.builder() + .addressTypeCode("MAILING").addressLine1("123 This Street").city("Victoria") + .provinceCode("BC").countryCode("CA").postal("V1V2V3").schoolEntity(fromSchoolEntity).build(); + schoolAddressSet.add(fromSchoolAddressEntity); + + toSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setAddresses(schoolAddressSet); + schoolRepository.save(fromSchoolEntity); + + School toSchool = new School(); + SchoolMapper map = SchoolMapper.mapper; + + BeanUtils.copyProperties(map.toStructure(toSchoolEntity), toSchool); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + MoveSchoolData moveSchoolData = createMoveSchoolData(toSchool, fromSchoolEntity.getSchoolId(), moveDate); + + UUID sagaId = UUID.randomUUID(); + final Event event = Event.builder().eventType(MOVE_SCHOOL).sagaId(sagaId).eventPayload(objectMapper.writeValueAsString(moveSchoolData)).build(); + + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + Optional schoolUpdatedEvent = instituteEventRepository.findBySagaIdAndEventType(sagaId, MOVE_SCHOOL.toString()); + assertThat(schoolUpdatedEvent).isPresent(); + assertThat(schoolUpdatedEvent.get().getEventStatus()).isEqualTo(MESSAGE_PUBLISHED.toString()); + assertThat(schoolUpdatedEvent.get().getEventOutcome()).isEqualTo(SCHOOL_MOVED.toString()); + + //check that data in event payload is updated + MoveSchoolData moveSchoolEventData = JsonUtil.getJsonObjectFromString(MoveSchoolData.class, event.getEventPayload()); + assertThat(moveSchoolEventData.getToSchool().getSchoolId()).isNotNull(); + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).isNotEqualTo("96100"); //new school number since school number already exists in district + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).startsWith("96"); + + //2 schools = 1 that was created + 1 that was closed for the move. + assertThat(schoolRepository.findAll()).hasSize(2); + + //confirm that running the same event twice will not create a new school. + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + assertThat(schoolRepository.findAll()).hasSize(2); + + SchoolEntity fromSchoolEntityComplete = schoolRepository.findById(fromSchoolEntity.getSchoolId()).orElseThrow(); + SchoolEntity toSchoolEntityComplete = schoolRepository.findById(UUID.fromString(moveSchoolEventData.getToSchool().getSchoolId())).orElseThrow(); + + //confirm previous school has closed and address information saved + assertThat(fromSchoolEntityComplete.getClosedDate()).isEqualTo(moveDate); + assertThat(fromSchoolEntityComplete.getAddresses().stream().toList().get(0).getCity()).isEqualTo(fromSchoolAddressEntity.getCity()); + + assertThat(fromSchoolEntityComplete.getSchoolMoveTo().stream().toList().get(0).getToSchoolId()).isEqualTo(toSchoolEntityComplete.getSchoolId()); + assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); + } + + @Test + public void testHandleEvent_givenEventTypeMOVE_SCHOOL_withNonIndependentSchoolCategory__DoesExistAndSynchronousNatsMessage_shouldRespondWithDataAndCreateMoveHistory() throws IOException, ExecutionException, InterruptedException { + final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData()); + SchoolEntity toSchoolEntity = this.createNewSchoolData("97100", "FED_BAND", "STANDARD"); + SchoolEntity fromSchoolEntity = this.createNewSchoolData("97100", "FED_BAND", "STANDARD"); + LocalDateTime moveDate = LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MILLIS); + + Set schoolAddressSet = new HashSet<>(); + SchoolAddressEntity fromSchoolAddressEntity = SchoolAddressEntity.builder() + .addressTypeCode("MAILING").addressLine1("123 This Street").city("Victoria") + .provinceCode("BC").countryCode("CA").postal("V1V2V3").schoolEntity(fromSchoolEntity).build(); + schoolAddressSet.add(fromSchoolAddressEntity); + + toSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setAddresses(schoolAddressSet); + schoolRepository.save(fromSchoolEntity); + + School toSchool = new School(); + SchoolMapper map = SchoolMapper.mapper; + + BeanUtils.copyProperties(map.toStructure(toSchoolEntity), toSchool); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + MoveSchoolData moveSchoolData = createMoveSchoolData(toSchool, fromSchoolEntity.getSchoolId(), moveDate); + + UUID sagaId = UUID.randomUUID(); + final Event event = Event.builder().eventType(MOVE_SCHOOL).sagaId(sagaId).eventPayload(objectMapper.writeValueAsString(moveSchoolData)).build(); + + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + Optional schoolUpdatedEvent = instituteEventRepository.findBySagaIdAndEventType(sagaId, MOVE_SCHOOL.toString()); + assertThat(schoolUpdatedEvent).isPresent(); + assertThat(schoolUpdatedEvent.get().getEventStatus()).isEqualTo(MESSAGE_PUBLISHED.toString()); + assertThat(schoolUpdatedEvent.get().getEventOutcome()).isEqualTo(SCHOOL_MOVED.toString()); + + //check that data in event payload is updated + MoveSchoolData moveSchoolEventData = JsonUtil.getJsonObjectFromString(MoveSchoolData.class, event.getEventPayload()); + assertThat(moveSchoolEventData.getToSchool().getSchoolId()).isNotNull(); + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).isEqualTo("97000"); //new school number since school number already exists in district + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).startsWith("97"); + + //2 schools = 1 that was created + 1 that was closed for the move. + assertThat(schoolRepository.findAll()).hasSize(2); + + //confirm that running the same event twice will not create a new school. + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + assertThat(schoolRepository.findAll()).hasSize(2); + + SchoolEntity fromSchoolEntityComplete = schoolRepository.findById(fromSchoolEntity.getSchoolId()).orElseThrow(); + SchoolEntity toSchoolEntityComplete = schoolRepository.findById(UUID.fromString(moveSchoolEventData.getToSchool().getSchoolId())).orElseThrow(); + + //confirm previous school has closed and address information saved + assertThat(fromSchoolEntityComplete.getClosedDate()).isEqualTo(moveDate); + assertThat(fromSchoolEntityComplete.getAddresses().stream().toList().get(0).getCity()).isEqualTo(fromSchoolAddressEntity.getCity()); + + assertThat(fromSchoolEntityComplete.getSchoolMoveTo().stream().toList().get(0).getToSchoolId()).isEqualTo(toSchoolEntityComplete.getSchoolId()); + assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); + } + + @Test + public void testHandleEvent_givenEventTypeMOVE_SCHOOL_withIndependentSchoolCategoryChange__DoesExistAndSynchronousNatsMessage_shouldRespondWithDataAndCreateMoveHistory() throws IOException, ExecutionException, InterruptedException { + final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData()); + SchoolEntity toSchoolEntity = this.createNewSchoolData("97100", "FED_BAND", "STANDARD"); + SchoolEntity fromSchoolEntity = this.createNewSchoolData("96100", "OFFSHORE", "STANDARD"); + LocalDateTime moveDate = LocalDateTime.now().plusDays(1).truncatedTo(ChronoUnit.MILLIS); + + Set schoolAddressSet = new HashSet<>(); + SchoolAddressEntity fromSchoolAddressEntity = SchoolAddressEntity.builder() + .addressTypeCode("MAILING").addressLine1("123 This Street").city("Victoria") + .provinceCode("BC").countryCode("CA").postal("V1V2V3").schoolEntity(fromSchoolEntity).build(); + schoolAddressSet.add(fromSchoolAddressEntity); + + toSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setDistrictEntity(dist); + fromSchoolEntity.setAddresses(schoolAddressSet); + schoolRepository.save(fromSchoolEntity); + + School toSchool = new School(); + SchoolMapper map = SchoolMapper.mapper; + + BeanUtils.copyProperties(map.toStructure(toSchoolEntity), toSchool); + + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + + MoveSchoolData moveSchoolData = createMoveSchoolData(toSchool, fromSchoolEntity.getSchoolId(), moveDate); + + UUID sagaId = UUID.randomUUID(); + final Event event = Event.builder().eventType(MOVE_SCHOOL).sagaId(sagaId).eventPayload(objectMapper.writeValueAsString(moveSchoolData)).build(); + + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + Optional schoolUpdatedEvent = instituteEventRepository.findBySagaIdAndEventType(sagaId, MOVE_SCHOOL.toString()); + assertThat(schoolUpdatedEvent).isPresent(); + assertThat(schoolUpdatedEvent.get().getEventStatus()).isEqualTo(MESSAGE_PUBLISHED.toString()); + assertThat(schoolUpdatedEvent.get().getEventOutcome()).isEqualTo(SCHOOL_MOVED.toString()); + + //check that data in event payload is updated + MoveSchoolData moveSchoolEventData = JsonUtil.getJsonObjectFromString(MoveSchoolData.class, event.getEventPayload()); + assertThat(moveSchoolEventData.getToSchool().getSchoolId()).isNotNull(); + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).isEqualTo("97000"); //new school number since school number already exists in district + assertThat(moveSchoolEventData.getToSchool().getSchoolNumber()).startsWith("97"); + + //2 schools = 1 that was created + 1 that was closed for the move. + assertThat(schoolRepository.findAll()).hasSize(2); + + //confirm that running the same event twice will not create a new school. + eventHandlerServiceUnderTest.handleMoveSchoolEvent(event).getLeft(); + assertThat(schoolRepository.findAll()).hasSize(2); + + SchoolEntity fromSchoolEntityComplete = schoolRepository.findById(fromSchoolEntity.getSchoolId()).orElseThrow(); + SchoolEntity toSchoolEntityComplete = schoolRepository.findById(UUID.fromString(moveSchoolEventData.getToSchool().getSchoolId())).orElseThrow(); + + //confirm previous school has closed and address information saved + assertThat(fromSchoolEntityComplete.getClosedDate()).isEqualTo(moveDate); + assertThat(fromSchoolEntityComplete.getAddresses().stream().toList().get(0).getCity()).isEqualTo(fromSchoolAddressEntity.getCity()); + + assertThat(fromSchoolEntityComplete.getSchoolMoveTo().stream().toList().get(0).getToSchoolId()).isEqualTo(toSchoolEntityComplete.getSchoolId()); + assertThat(toSchoolEntityComplete.getSchoolMoveFrom().stream().toList().get(0).getFromSchoolId()).isEqualTo(fromSchoolEntityComplete.getSchoolId()); + } + @Test public void testHandleEvent_givenEventTypeMOVE_SCHOOL__ToSchoolIdDoesNotExist_shouldThrowEntitynotFoundException() throws IOException, ExecutionException, InterruptedException { final DistrictTombstoneEntity dist = this.districtTombstoneRepository.save(this.createDistrictData());