Skip to content

Commit

Permalink
fix: LessonServiceTest 병합 충돌 해결 (#79) (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
leesewon00 authored Feb 12, 2024
1 parent 6541532 commit 78d7c88
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void findLessons_fail_empty_list() {
userRepository.save(user);

when(userRepository.findById(user.getId()))
.thenReturn(Optional.of(user));
when(userLessonRepository.findByUserAndAttendedSemester(user, "semester"))
.thenReturn(Optional.empty());
LessonException exception = assertThrows(
Expand Down Expand Up @@ -107,6 +108,7 @@ void findLessonDetails_fail_invalid_lessonId() {

when(lessonRepository.findById(lesson.getId()))
.thenReturn(Optional.empty());

LessonException exception = assertThrows(
LessonException.class, () -> {
lessonService.findLessonDetails(lesson.getId());
Expand All @@ -133,6 +135,7 @@ void findLessonDetails_success() {
@Test
@DisplayName("[커스텀 수업 생성 실패] invalid userId")
void createCustomLesson_fail_invalid_userId() {

LessonRequestDTO.CreateDTO createDTO = new LessonRequestDTO.CreateDTO();
User user = new User();
userRepository.save(user);
Expand Down Expand Up @@ -191,12 +194,14 @@ void createCustomLesson_success_notNew_notDup() {

@Test
@DisplayName("[커스텀 수업 생성 실패] new(x) dup(o)")
void createCustomLesson_success_notNew_Dup() {
LessonRequestDTO.CreateDTO createDTO = new LessonRequestDTO.CreateDTO("AttendedSemester", "Semester", "LessonName",
"ProfessorName", "Location", "StartTime", "RunningTime", "DayOfWeek");
User user = new User();
userRepository.save(user);

UserLesson userLesson = new UserLesson();

Lesson existingLesson = Lesson.createLesson(user.getUniversity(), createDTO.getSemester(), createDTO.getLessonName(),
createDTO.getProfessorName(), createDTO.getLocation(), createDTO.getStartTime(),
createDTO.getRunningTime(), createDTO.getDayOfWeek());
Expand Down Expand Up @@ -308,4 +313,5 @@ void deleteUserLesson_fail_invalid_lessonId() {
assertThat(exception.getErrorReasonHttpStatus())
.isEqualTo(ErrorStatus.LESSON_NOT_FOUND.getReasonHttpStatus());
}

}

0 comments on commit 78d7c88

Please sign in to comment.