Skip to content

Commit 3ec1e90

Browse files
committed
test: 케이스 추가 및 변경사항 적용 확인
1 parent a0200cb commit 3ec1e90

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private StudyPlan createDailyPlan() {
135135
}
136136

137137
@Test
138-
@DisplayName("단발성 계획 생성")
138+
@DisplayName("단발성 계획 생성 - 하나에만 밀리초가 들어가도 되는가?!")
139139
void t1() throws Exception {
140140

141141
ResultActions resultActions = mvc.perform(post("/api/plans")
@@ -144,8 +144,8 @@ void t1() throws Exception {
144144
.content("""
145145
{
146146
"subject": "단발성 계획",
147-
"startDate": "2025-09-26T10:46:00",
148-
"endDate": "2025-09-26T11:46:00",
147+
"startDate": "2025-10-03T17:00:00",
148+
"endDate": "2025-10-03T18:30:00.000",
149149
"color": "RED"
150150
}
151151
"""))
@@ -162,14 +162,14 @@ void t1() throws Exception {
162162
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 생성되었습니다."))
163163
.andExpect(jsonPath("$.data.subject").value("단발성 계획"))
164164
.andExpect(jsonPath("$.data.color").value("RED"))
165-
.andExpect(jsonPath("$.data.startDate").value("2025-09-26T10:46:00"))
166-
.andExpect(jsonPath("$.data.endDate").value("2025-09-26T11:46:00"))
165+
.andExpect(jsonPath("$.data.startDate").value("2025-10-03T17:00:00"))
166+
.andExpect(jsonPath("$.data.endDate").value("2025-10-03T18:30:00"))
167167
.andExpect(jsonPath("$.data.repeatRule").doesNotExist());
168168

169169
}
170170

171171
@Test
172-
@DisplayName("단발성 계획 생성 - 밀리초까지 전송받는 경우")
172+
@DisplayName("단발성 계획 생성 - 밀리초까지도 둘 다 전송받는 경우")
173173
void t1_1() throws Exception {
174174

175175
ResultActions resultActions = mvc.perform(post("/api/plans")
@@ -178,13 +178,23 @@ void t1_1() throws Exception {
178178
.content("""
179179
{
180180
"subject": "단발성 계획 - 밀리초 포함",
181-
"startDate": "2025-09-21T05:00:00.000Z",
182-
"endDate": "2025-09-21T07:00:00.000Z",
181+
"startDate": "2025-09-21T05:00:00.000",
182+
"endDate": "2025-09-21T07:00:00.000",
183183
"color": "RED"
184184
}
185185
"""))
186186
.andDo(print());
187187

188+
resultActions
189+
.andExpect(status().isOk()) // 200 OK인지 확인
190+
.andExpect(handler().handlerType(StudyPlanController.class))
191+
.andExpect(handler().methodName("createStudyPlan"))
192+
.andExpect(jsonPath("$.success").value(true))
193+
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 생성되었습니다."))
194+
.andExpect(jsonPath("$.data.startDate").value("2025-09-21T05:00:00"))
195+
.andExpect(jsonPath("$.data.endDate").value("2025-09-21T07:00:00"))
196+
.andExpect(jsonPath("$.data.repeatRule").doesNotExist());
197+
188198
}
189199

190200
@Test

0 commit comments

Comments
 (0)