Skip to content

Commit

Permalink
Fix username for student history
Browse files Browse the repository at this point in the history
  • Loading branch information
arybakov-cgi committed Aug 21, 2024
1 parent ca11635 commit c6629a1
Showing 1 changed file with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public void testGetStudentOptionalProgramHistoryByID() {
public void testGetStudentHistoryByBatchID() {
// ID
UUID studentID = UUID.randomUUID();
UUID historyID = UUID.randomUUID();
List<GraduationStudentRecordHistoryEntity> histList = new ArrayList<>();

Student std = new Student();
Expand Down Expand Up @@ -274,7 +273,6 @@ public void testGetStudentHistoryByBatchID() {
public void testUpdateStudentRecordHistoryDistributionRun() {
// ID
UUID studentID = UUID.randomUUID();
UUID historyID = UUID.randomUUID();
List<GraduationStudentRecordHistoryEntity> histList = new ArrayList<>();

Student std = new Student();
Expand Down Expand Up @@ -306,7 +304,6 @@ public void testUpdateStudentRecordHistoryDistributionRun() {
graduationStudentRecordHistoryEntity.setLegalMiddleNames("Adad");
graduationStudentRecordHistoryEntity.setLegalLastName("sadad");
histList.add(graduationStudentRecordHistoryEntity);
Pageable paging = PageRequest.of(0, 10);
Page<GraduationStudentRecordHistoryEntity> hPage = new PageImpl(histList);

GraduationStudentRecordEntity graduationStudentRecordEntity = new GraduationStudentRecordEntity();
Expand All @@ -318,25 +315,20 @@ public void testUpdateStudentRecordHistoryDistributionRun() {
when(graduationStudentRecordRepository.findByStudentID(studentID)).thenReturn(graduationStudentRecordEntity);

var result = historyService.updateStudentRecordHistoryDistributionRun(4000L, "USER", "activityCode", List.of(studentID));
assertThat(result).isNotNull();
assertThat(result).isEqualTo(0);
assertThat(result).isNotNull().isZero();

when(graduationStudentRecordHistoryRepository.findByBatchId(4000L, PageRequest.of(0, Integer.SIZE))).thenReturn(null);
result = historyService.updateStudentRecordHistoryDistributionRun(4000L, "USER", "activityCode", List.of(studentID));
assertThat(result).isNotNull();
assertThat(result).isEqualTo(1);
assertThat(result).isNotNull().isEqualTo(1);

when(graduationStudentRecordHistoryRepository.findByBatchId(4000L, PageRequest.of(0, Integer.SIZE))).thenReturn(new PageImpl(List.of()));
result = historyService.updateStudentRecordHistoryDistributionRun(4000L, "USER", "activityCode", List.of(studentID));
assertThat(result).isNotNull();
assertThat(result).isEqualTo(1);
assertThat(result).isNotNull().isEqualTo(1);

result = historyService.updateStudentRecordHistoryDistributionRun(4000L, "USER", "activityCode", List.of());
assertThat(result).isNotNull();
assertThat(result).isEqualTo(0);
assertThat(result).isNotNull().isZero();

result = historyService.updateStudentRecordHistoryDistributionRun(4000L, "USER", "", List.of());
assertThat(result).isNotNull();
assertThat(result).isEqualTo(0);
assertThat(result).isNotNull().isZero();
}
}

0 comments on commit c6629a1

Please sign in to comment.