Skip to content
Merged
Show file tree
Hide file tree
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 @@ -10,7 +10,7 @@

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2025-02-20T02:36:18+0900",
date = "2025-02-20T20:15:43+0900",
comments = "version: 1.6.3, compiler: javac, environment: Java 17.0.10 (JetBrains s.r.o.)"
)
@Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,5 @@ private void validateByType(String answer, AnswerType answerType) {
throw new InvalidValueException(ErrorCode.INVALID_MULTIPLE_CHOICE_ANSWER);
}
}
if (answerType == AnswerType.SHORT_ANSWER) {
try {
int numericAnswer = Integer.parseInt(answer);
if (numericAnswer < 0 || numericAnswer > 999) {
throw new InvalidValueException(ErrorCode.INVALID_SHORT_NUMBER_ANSWER);
}
} catch (NumberFormatException e) {
throw new InvalidValueException(ErrorCode.INVALID_SHORT_NUMBER_ANSWER);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public interface ChildProblemMapper {

ChildProblem from(ChildProblemPostRequest request);

@Mapping(target = "id", source = "id")
@Mapping(target = "id", source = "childProblemId")
ChildProblem from(ChildProblemUpdateRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class 어드민_로그인 {
.contentType("application/json")
.content(requestBody))
.andExpect(status().isOk()) // HTTP 200 응답 확인
.andExpect(jsonPath("$.accessToken").isNotEmpty()) // accessToken 필드 존재 여부 확인
.andExpect(jsonPath("$.data.accessToken").isNotEmpty()) // accessToken 필드 존재 여부 확인
.andExpect(cookie().exists("refreshToken")) // 리프레시 토큰 쿠키 존재 확인
.andExpect(cookie().httpOnly("refreshToken", true)) // HTTP Only 설정 확인
.andExpect(cookie().secure("refreshToken", true)) // Secure 설정 확인
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void setUp() {
ChildProblemUpdateRequest updateChildProblem2 = new ChildProblemUpdateRequest(
2L,
"updatedChild2.png",
AnswerType.SHORT_STRING_ANSWER,
AnswerType.SHORT_ANSWER,
"23",
Set.of(3L, 4L)
);
Expand All @@ -75,7 +75,7 @@ void setUp() {
"updatedReadingTip.png",
"updatedSeniorTip.png",
List.of("prescription1.png", "prescription2.png"),
AnswerType.SHORT_STRING_ANSWER,
AnswerType.SHORT_ANSWER,
List.of(updateChildProblem1, updateChildProblem2),
30,
45
Expand Down Expand Up @@ -114,7 +114,7 @@ class 문제_업데이트_정상_동작 {
.containsExactly("prescription1.png", "prescription2.png");

// 답안 유형 검증
assertThat(response.answerType()).isEqualTo(AnswerType.SHORT_STRING_ANSWER);
assertThat(response.answerType()).isEqualTo(AnswerType.SHORT_ANSWER);

Problem updatedProblem = problemRepository.findByIdElseThrow(1L);

Expand All @@ -132,7 +132,7 @@ class 문제_업데이트_정상_동작 {
// 두 번째 자식 문제 검증 (새로 추가된 문제)
ChildProblem newChild = childProblems.get(1);
assertThat(newChild.getImageUrl()).isEqualTo("updatedChild2.png");
assertThat(newChild.getAnswerType()).isEqualTo(AnswerType.SHORT_STRING_ANSWER);
assertThat(newChild.getAnswerType()).isEqualTo(AnswerType.SHORT_ANSWER);
assertThat(newChild.getAnswer()).isEqualTo("23");
assertThat(newChild.getConceptTagIds()).containsExactlyInAnyOrderElementsOf(Set.of(3L, 4L));

Expand Down Expand Up @@ -173,7 +173,7 @@ class 문제_업데이트_예외_처리 {
"updatedReadingTip.png",
"updatedSeniorTip.png",
List.of("prescription1.png"),
AnswerType.SHORT_STRING_ANSWER,
AnswerType.SHORT_ANSWER,
List.of(),
30,
45
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/insert-problem.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ INSERT INTO child_problem (child_problem_id,
answer,
sequence)
VALUES (1, 1, 'child1.png', 'MULTIPLE_CHOICE', '1', 0),
(2, 1, 'child2.png', 'SHORT_STRING_ANSWER', '정답2', 1);
(2, 1, 'child2.png', 'SHORT_ANSWER', '정답2', 1);

-- 문제-컨셉 태그 연결 테이블 생성
CREATE TABLE IF NOT EXISTS problem_concept (
Expand Down
18 changes: 11 additions & 7 deletions src/test/resources/insert-problem2.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
DELETE FROM child_problem_concept;
DELETE FROM problem_concept;
DELETE FROM child_problem;
DELETE FROM problem;
DELETE
FROM child_problem_concept;
DELETE
FROM problem_concept;
DELETE
FROM child_problem;
DELETE
FROM problem;

-- problem 데이터 삽입
INSERT INTO problem (problem_id,
Expand Down Expand Up @@ -35,7 +39,7 @@ VALUES (1, '24052001001', 1, 1, 'GICHUL_PROBLEM', '제목1', '1', 5, '기존 문

(3, '24052001003', 1, 3, 'GICHUL_PROBLEM', '제목3', '3', 3, '문제 3 설명',
'mainProblem3.png', 'mainAnalysis3.png', 'mainHandwriting3.png', 'readingTip3.png', 'seniorTip3.png',
'prescription5.png, prescription6.png', 'SHORT_STRING_ANSWER', true,
'prescription5.png, prescription6.png', 'SHORT_ANSWER', true,
15, 45);

-- 자식 문제 데이터 삽입
Expand All @@ -46,9 +50,9 @@ INSERT INTO child_problem (child_problem_id,
answer,
sequence)
VALUES (1, 1, 'child1.png', 'MULTIPLE_CHOICE', '1', 0),
(2, 1, 'child2.png', 'SHORT_STRING_ANSWER', '정답2', 1),
(2, 1, 'child2.png', 'SHORT_ANSWER', '정답2', 1),
(3, 2, 'child3.png', 'MULTIPLE_CHOICE', '2', 0),
(4, 3, 'child4.png', 'SHORT_STRING_ANSWER', '3', 0);
(4, 3, 'child4.png', 'SHORT_ANSWER', '3', 0);

-- 문제-컨셉 태그 연결
INSERT INTO problem_concept (problem_id, concept_tag_id)
Expand Down