Skip to content

Commit

Permalink
GRAD2-2817
Browse files Browse the repository at this point in the history
TVR Delete Process - Backend Changes Endpoints
  • Loading branch information
arybakov-cgi committed Aug 28, 2024
1 parent fa361bc commit d96374f
Showing 1 changed file with 84 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1706,12 +1706,92 @@ public void testGetStudentIDsByStudentGuidsAndReportType() {

UUID uuid = UUID.randomUUID();
Pageable paging = PageRequest.of(0, 1);
Mockito.when(gradStudentReportsRepository.getReportStudentIDsByStudentIDsAndReportType(List.of(uuid), "reportType", paging)).thenReturn(Page.empty());
List<UUID> result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(uuid.toString()), "reportType", 100);
assertThat(result).isNotNull().isEmpty();
Mockito.when(gradStudentReportsRepository.getReportStudentIDsByStudentIDsAndReportType(List.of(uuid), "reportType", paging)).thenReturn(new Page() {
@Override
public Iterator<UUID> iterator() {
return getContent().listIterator();
}

@Override
public int getNumber() {
return 1;
}

@Override
public int getSize() {
return 1;
}

@Override
public int getNumberOfElements() {
return 1;
}

@Override
public List<UUID> getContent() {
return List.of(uuid);
}

@Override
public boolean hasContent() {
return !getContent().isEmpty();
}

@Override
public Sort getSort() {
return null;
}

@Override
public boolean isFirst() {
return false;
}

@Override
public boolean isLast() {
return false;
}

@Override
public boolean hasNext() {
return false;
}

@Override
public boolean hasPrevious() {
return false;
}

@Override
public Pageable nextPageable() {
return null;
}

@Override
public Pageable previousPageable() {
return null;
}

@Override
public int getTotalPages() {
return getContent().size();
}

@Override
public long getTotalElements() {
return getContent().size();
}

@Override
public Page map(Function converter) {
return null;
}
});
List<UUID> result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(uuid.toString()), "reportType", 1);
assertThat(result).isNotNull().isNotEmpty();

Mockito.when(gradStudentReportsRepository.findStudentIDByGradReportTypeCode("reportType", paging)).thenReturn(Page.empty());
result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(), "reportType", 100);
result = commonService.getStudentIDsByStudentGuidsAndReportType(List.of(), "reportType", 1);
assertThat(result).isNotNull().isEmpty();
}

Expand Down

0 comments on commit d96374f

Please sign in to comment.