Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void initTestCase() throws Exception {
List<Course> courses = courseUtilService.createCoursesWithExercisesAndLectures(TEST_PREFIX, true, true, numberOfTutors);
this.course1 = this.courseRepository.findByIdWithExercisesAndExerciseDetailsAndLecturesElseThrow(courses.getFirst().getId());

var lectures = this.course1.getLectures().stream().toList();
var lectures = this.course1.getLectures().stream().sorted(Comparator.comparing(Lecture::getStartDate)).toList();
createChannelsForLectures(lectures);

lecture2.setIsTutorialLecture(true);
Expand Down Expand Up @@ -544,12 +544,12 @@ void testCreateLectureSeriesAndCorrectLectureAndChannelNames() throws Exception

request.postWithoutResponseBody("/api/lecture/courses/" + course1.getId() + "/lectures", List.of(dto1, dto2), HttpStatus.NO_CONTENT);

List<Lecture> lectures = lectureRepository.findAllByCourseId(course1.getId()).stream().sorted(Comparator.comparing(Lecture::getStartDate)).toList();
assertThat(lectures).hasSize(4);
Lecture firstLecture = lectures.getFirst();
Lecture secondLecture = lectures.get(1);
Lecture thirdLecture = lectures.get(2);
Lecture fourthLecture = lectures.get(3);
List<Lecture> lecturesAfter = lectureRepository.findAllByCourseId(course1.getId()).stream().sorted(Comparator.comparing(Lecture::getStartDate)).toList();
assertThat(lecturesAfter).hasSize(4);
Lecture firstLecture = lecturesAfter.getFirst();
Lecture secondLecture = lecturesAfter.get(1);
Lecture thirdLecture = lecturesAfter.get(2);
Lecture fourthLecture = lecturesAfter.get(3);

assertThat(firstLecture.getTitle()).isEqualTo(titleNewLecture1);
assertThat(firstLecture.getStartDate().toInstant()).isEqualTo(startNewLecture1.toInstant());
Expand All @@ -564,7 +564,7 @@ void testCreateLectureSeriesAndCorrectLectureAndChannelNames() throws Exception

Set<Channel> channels = channelRepository.findLectureChannelsByCourseId(course1.getId());

assertThat(channels.stream().map(Channel::getLecture).collect(Collectors.toSet())).containsExactlyInAnyOrderElementsOf(lectures);
assertThat(channels.stream().map(Channel::getLecture).collect(Collectors.toSet())).containsExactlyInAnyOrderElementsOf(lecturesAfter);

Map<Long, Channel> lectureIdToChannelMap = channels.stream().collect(Collectors.toMap(channel -> channel.getLecture().getId(), Function.identity()));
Channel firstLectureChannel = lectureIdToChannelMap.get(firstLecture.getId());
Expand Down
Loading