-
Notifications
You must be signed in to change notification settings - Fork 1
종일 학사일정이 2일에 걸쳐 표시되는 현상 수정 #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9339bd3
d3f8853
eeb8d5a
47a5586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
|
@@ -60,7 +61,7 @@ void convert_ics_event_to_academic_event() { | |
| //then | ||
| assertEventFields(academicEvent, "하계방학", 0, Transparent.TRANSPARENT, false, | ||
| LocalDateTime.of(2024, 6, 22, 0, 0), | ||
| LocalDateTime.of(2024, 9, 2, 0, 0)); | ||
| LocalDateTime.of(2024, 9, 1, 23, 59, 59)); | ||
| } | ||
|
|
||
| @DisplayName("다건 학사 이벤트 변환을 수행할 수 있다.") | ||
|
|
@@ -72,11 +73,11 @@ void convert_multi_ics_event_to_academic_event() { | |
| //then | ||
| assertEventFields(academicEvents.get(0), "하계방학", 0, Transparent.TRANSPARENT, false, | ||
| LocalDateTime.of(2024, 6, 22, 0, 0), | ||
| LocalDateTime.of(2024, 9, 2, 0, 0)); | ||
| LocalDateTime.of(2024, 9, 1, 23, 59, 59)); | ||
|
|
||
| assertEventFields(academicEvents.get(1), "폐강교과목 공지(1차)", 0, Transparent.TRANSPARENT, false, | ||
| LocalDateTime.of(2024, 9, 2, 0, 0), | ||
| LocalDateTime.of(2024, 9, 3, 0, 0)); | ||
| LocalDateTime.of(2024, 9, 2, 23, 59, 59)); | ||
| } | ||
|
|
||
| @DisplayName("공휴일 이벤트는 변환에서 제외") | ||
|
|
@@ -214,4 +215,208 @@ private void assertEventFields(AcademicEvent academicEvent, String summary, Inte | |
| () -> assertThat(academicEvent.getEndTime()).isEqualTo(endDate) | ||
| ); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("DTEND가 없는 종일 일정은 해당 날짜의 23시 59분 59초로 종료 시간을 설정한다") | ||
| void convert_all_day_event_without_dtend() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("개강") | ||
| .dtstart("20260831") | ||
| .dtend(null) | ||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isPresent(); | ||
|
|
||
| AcademicEvent event = result.get(); | ||
|
|
||
| assertThat(event.getStartTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 31, 0, 0, 0)); | ||
|
|
||
| assertThat(event.getEndTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 31, 23, 59, 59)); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("DTEND가 없는 일반 일정은 시작 시간과 종료 시간을 동일하게 설정한다") | ||
| void convert_non_all_day_event_without_dtend() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("수강신청") | ||
| .dtstart("20260818T093000") | ||
| .dtend(null) | ||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isPresent(); | ||
|
|
||
| AcademicEvent event = result.get(); | ||
|
|
||
| assertThat(event.getStartTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 9, 30)); | ||
|
|
||
| assertThat(event.getEndTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 9, 30)); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("DTSTART가 없으면 변환하지 않는다") | ||
| void convert_without_dtstart() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("개강") | ||
| .dtstart(null) | ||
| .dtend("20260818") | ||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isEmpty(); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("DTSTART와 DTEND의 형식이 다르면 변환하지 않는다") | ||
| void convert_different_dtstart_dtend_format() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("개강") | ||
| .dtstart("20260831") | ||
| .dtend("20260901T090000") | ||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isEmpty(); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("종일 일정은 종료 시간을 1초 앞당겨 변환한다") | ||
| void convert_all_day_event() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("개강") | ||
| .dtstart("20260817") | ||
| .dtend("20260818") | ||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isPresent(); | ||
|
|
||
| AcademicEvent event = result.get(); | ||
|
|
||
| assertThat(event.getStartTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 17, 0, 0, 0)); | ||
|
|
||
| assertThat(event.getEndTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 17, 23, 59, 59)); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("종일 일정이 아닌 경우 시작 시간과 종료 시간을 그대로 유지한다") | ||
| void convert_non_all_day_event() { | ||
| // given | ||
| IcsEvent icsEvent = IcsEvent.builder() | ||
| .uid("test-uid") | ||
| .summary("수강신청") | ||
| .dtstart("20260818T093000") | ||
| .dtend("20260818T170000") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 명시적 동일 시각의 현재 테스트는 서로 다른 시작·종료 시각만 검증합니다. 별도 테스트에 학습 내용 근거: 새 중요 로직에는 집중 테스트가 필요합니다. 🤖 Prompt for AI AgentsSource: Learnings ✅ Addressed in commit eeb8d5a |
||
| .build(); | ||
|
|
||
| // when | ||
| Optional<AcademicEvent> result = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent); | ||
|
|
||
| // then | ||
| assertThat(result).isPresent(); | ||
|
|
||
| AcademicEvent event = result.get(); | ||
|
|
||
| assertThat(event.getStartTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 9, 30)); | ||
|
|
||
| assertThat(event.getEndTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 17, 0)); | ||
| } | ||
|
|
||
| @DisplayName("종일 이벤트의 종료 시간이 시작 시간보다 이전이면 변환에서 제외") | ||
| @Test | ||
| void convert_exclude_all_day_event_when_end_time_is_before_start_time() { | ||
| // given | ||
| IcsEvent icsEvent = new IcsEvent( | ||
| "test-uid", | ||
| "테스트 일정", | ||
| "설명", | ||
| "20260817", | ||
| "20260817", | ||
| "PUBLIC", | ||
| "0", | ||
| "20260817T000000Z", | ||
| "TRANSPARENT", | ||
| "CONFIRMED", | ||
| "0", | ||
| "" | ||
| ); | ||
|
|
||
| // when | ||
| AcademicEvent academicEvent = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent).orElse(null); | ||
|
|
||
| // then | ||
| assertThat(academicEvent).isNull(); | ||
| } | ||
|
|
||
| @DisplayName("일반 이벤트의 시작 시간과 종료 시간이 같으면 변환에서 제외") | ||
| @Test | ||
| void convert_non_all_day_event_with_same_start_and_end_time() { | ||
| // given | ||
| IcsEvent icsEvent = new IcsEvent( | ||
| "test-uid", | ||
| "테스트 일정", | ||
| "설명", | ||
| "20260818T093000", | ||
| "20260818T093000", | ||
| "PUBLIC", | ||
| "0", | ||
| "20260818T093000Z", | ||
| "TRANSPARENT", | ||
| "CONFIRMED", | ||
| "0", | ||
| "" | ||
| ); | ||
|
|
||
| // when | ||
| AcademicEvent academicEvent = | ||
| AcademicEventConverter.convertToAcademicEvent(icsEvent).orElse(null); | ||
|
|
||
| // then | ||
| assertThat(academicEvent).isNotNull(); | ||
| assertThat(academicEvent.getStartTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 9, 30)); | ||
| assertThat(academicEvent.getEndTime()) | ||
| .isEqualTo(LocalDateTime.of(2026, 8, 18, 9, 30)); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.