Skip to content

Commit

Permalink
Add identify student test
Browse files Browse the repository at this point in the history
  • Loading branch information
eckermania committed Jul 22, 2024
1 parent 4a9545c commit 0e42037
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -369,4 +370,61 @@ void testUpdateStudentAndResolveDistrictDuplicates_typeCHANGE_GRADE_WithValidati
val resolvedDuplicate = sdcDuplicateService.changeGrade(UUID.fromString(programDupe.get().getSdcDuplicateID()), student1Entity);
assertThat(resolvedDuplicate.getDuplicateResolutionCode()).isNull();
}

@Test
void testIdentifyingStudentToEdit_ShouldCorrectlyIdentifyStudent(){
CollectionEntity collection = createMockCollectionEntity();
collection.setCloseDate(LocalDateTime.now().plusDays(2));
collectionRepository.save(collection);

SchoolTombstone schoolTombstone1 = createMockSchool();
schoolTombstone1.setSchoolCategoryCode(SchoolCategoryCodes.INDEPEND.getCode());
SdcSchoolCollectionEntity sdcSchoolCollectionEntity1 = createMockSdcSchoolCollectionEntity(collection, UUID.fromString(schoolTombstone1.getSchoolId()));

SchoolTombstone schoolTombstone2 = createMockSchool();
SdcSchoolCollectionEntity sdcSchoolCollectionEntity2 = createMockSdcSchoolCollectionEntity(collection, UUID.fromString(schoolTombstone2.getSchoolId()));

SchoolTombstone schoolTombstone3 = createMockSchool();
schoolTombstone3.setFacilityTypeCode(FacilityTypeCodes.POST_SEC.getCode());
SdcSchoolCollectionEntity sdcSchoolCollectionEntity3 = createMockSdcSchoolCollectionEntity(collection, UUID.fromString(schoolTombstone3.getSchoolId()));

SchoolTombstone schoolTombstone4 = createMockSchool();
schoolTombstone4.setSchoolCategoryCode(SchoolCategoryCodes.INDP_FNS.getCode());
schoolTombstone4.setMincode("03636019");
SdcSchoolCollectionEntity sdcSchoolCollectionEntity4 = createMockSdcSchoolCollectionEntity(collection, UUID.fromString(schoolTombstone4.getSchoolId()));

SdcSchoolCollectionStudentEntity student1 = createMockSchoolStudentEntity(sdcSchoolCollectionEntity1);
student1.setNumberOfCoursesDec(BigDecimal.valueOf(10.00));

SdcSchoolCollectionStudentEntity student2 = createMockSchoolStudentEntity(sdcSchoolCollectionEntity2);
student2.setNumberOfCoursesDec(BigDecimal.valueOf(12.00));

SdcSchoolCollectionStudentEntity student3 = createMockSchoolStudentEntity(sdcSchoolCollectionEntity2);
student3.setNumberOfCoursesDec(BigDecimal.valueOf(10.00));

SdcSchoolCollectionStudentEntity student4 = createMockSchoolStudentEntity(sdcSchoolCollectionEntity3);
student4.setNumberOfCoursesDec(BigDecimal.valueOf(10.00));

SdcSchoolCollectionStudentEntity student5 = createMockSchoolStudentEntity(sdcSchoolCollectionEntity4);
student5.setNumberOfCoursesDec(BigDecimal.valueOf(10.00));

SdcSchoolCollectionStudentEntity studentToEdit1 = sdcDuplicateService.identifyStudentToEdit(student1, student2, schoolTombstone1, schoolTombstone2);
assertThat(studentToEdit1).isEqualTo(student1);

SdcSchoolCollectionStudentEntity studentToEdit2 = sdcDuplicateService.identifyStudentToEdit(student1, student3, schoolTombstone1, schoolTombstone2);
assertThat(studentToEdit2).isEqualTo(student3);

SdcSchoolCollectionStudentEntity studentToEdit3 = sdcDuplicateService.identifyStudentToEdit(student3, student1, schoolTombstone2, schoolTombstone1);
assertThat(studentToEdit3).isEqualTo(student3);

SdcSchoolCollectionStudentEntity studentToEdit4 = sdcDuplicateService.identifyStudentToEdit(student3, student4, schoolTombstone2, schoolTombstone3);
assertThat(studentToEdit4).isEqualTo(student4);

SdcSchoolCollectionStudentEntity studentToEdit5 = sdcDuplicateService.identifyStudentToEdit(student4, student3, schoolTombstone3, schoolTombstone2);
assertThat(studentToEdit5).isEqualTo(student4);

SdcSchoolCollectionStudentEntity studentToEdit6 = sdcDuplicateService.identifyStudentToEdit(student5, student1, schoolTombstone4, schoolTombstone1);
assertThat(studentToEdit6).isEqualTo(student5);

}
}

0 comments on commit 0e42037

Please sign in to comment.