Skip to content

Commit 8c0ef3b

Browse files
committed
test: 테스트 케이스 추가
1 parent 2b09a74 commit 8c0ef3b

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,4 +855,69 @@ void t18() throws Exception {
855855
.count();
856856
assertThat(oct8Exceptions).isEqualTo(1);
857857
}
858+
859+
@Test
860+
@DisplayName("버그 수정: 10.5 일괄 수정 → 10.6 단일 수정 → 10.5 단일 삭제 시 10.7~10.10 수정 유지")
861+
void testBugFix_ModificationContinuesAfterSkippingException() throws Exception {
862+
// Given: 매일 반복되는 계획 생성 (10.1~10.10)
863+
StudyPlan originalPlan = createDailyPlan();
864+
Long planId = originalPlan.getId();
865+
866+
// When 1: 10.5 FROM_THIS_DATE 수정
867+
mvc.perform(MockMvcRequestBuilders.put("/api/plans/{planId}?applyScope=FROM_THIS_DATE", planId)
868+
.header("Authorization", "Bearer faketoken")
869+
.contentType(MediaType.APPLICATION_JSON)
870+
.content("""
871+
{
872+
"subject": "빨간색",
873+
"startDate": "2025-10-05T14:00:00",
874+
"endDate": "2025-10-05T15:00:00",
875+
"color": "RED"
876+
}
877+
"""))
878+
.andExpect(status().isOk());
879+
880+
// When 2: 10.6 THIS_ONLY 수정
881+
mvc.perform(MockMvcRequestBuilders.put("/api/plans/{planId}?applyScope=THIS_ONLY", planId)
882+
.header("Authorization", "Bearer faketoken")
883+
.contentType(MediaType.APPLICATION_JSON)
884+
.content("""
885+
{
886+
"subject": "초록색",
887+
"startDate": "2025-10-06T16:00:00",
888+
"endDate": "2025-10-06T17:00:00",
889+
"color": "GREEN"
890+
}
891+
"""))
892+
.andExpect(status().isOk());
893+
894+
// When 3: 10.5 THIS_ONLY 삭제
895+
mvc.perform(MockMvcRequestBuilders.delete("/api/plans/{planId}?selectedDate=2025-10-05&applyScope=THIS_ONLY", planId)
896+
.header("Authorization", "Bearer faketoken"))
897+
.andExpect(status().isOk());
898+
899+
// Then: 10.5 삭제됨
900+
mvc.perform(get("/api/plans/date/2025-10-05")
901+
.header("Authorization", "Bearer faketoken"))
902+
.andExpect(status().isOk())
903+
.andExpect(jsonPath("$.data.totalCount").value(0));
904+
905+
// Then: 10.6 초록색 유지
906+
mvc.perform(get("/api/plans/date/2025-10-06")
907+
.header("Authorization", "Bearer faketoken"))
908+
.andExpect(status().isOk())
909+
.andExpect(jsonPath("$.data.plans[0].subject").value("초록색"));
910+
911+
// Then: 10.7~10.10 빨간색 유지 (버그 수정 확인)
912+
mvc.perform(get("/api/plans/date/2025-10-07")
913+
.header("Authorization", "Bearer faketoken"))
914+
.andExpect(status().isOk())
915+
.andExpect(jsonPath("$.data.plans[0].subject").value("빨간색"));
916+
917+
mvc.perform(get("/api/plans/date/2025-10-10")
918+
.header("Authorization", "Bearer faketoken"))
919+
.andExpect(status().isOk())
920+
.andExpect(jsonPath("$.data.plans[0].subject").value("빨간색"));
921+
}
922+
858923
}

0 commit comments

Comments
 (0)