-
Notifications
You must be signed in to change notification settings - Fork 2
[BE] SISC1-179 [TEST] attendance controller test 코드 구현 #58
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
[BE] SISC1-179 [TEST] attendance controller test 코드 구현 #58
The head ref may contain hidden characters: "SISC1-179-BE-AttendanceControllerTest-\uCF54\uB4DC-\uC791\uC131"
Conversation
- 세션 CRUD 기능 테스트 - 권한별 접근 제어 검증 - 유효성 검증 및 예외 상황 테스트
Walkthrough컨트롤러는 User 객체 대신 UUID(userId/adminId)를 서비스에 전달하도록 변경되었고, 서비스는 전달된 UUID로 UserRepository에서 사용자/관리자를 조회하도록 수정되었습니다. 세션 활성화 시 startsAt을 현재 시각으로 설정하는 로직이 추가되었고, 컨트롤러용 WebMvcTest와 테스트 전용 보안 설정이 추가되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as 인증된 사용자
participant C as AttendanceController
participant S as AttendanceService
participant UR as UserRepository
User->>C: POST /attendance/sessions/{sessionId}/check-in
C->>S: checkIn(sessionId, request, userId)
S->>UR: findById(userId)
UR-->>S: User (또는 empty)
alt User 존재
S-->>C: AttendanceResponse
C-->>User: 200 OK + body
else User 미존재
S-->>C: throw NotFound
C-->>User: 4xx/5xx 에러
end
sequenceDiagram
autonumber
actor Admin as 관리자
participant C as AttendanceController
participant S as AttendanceService
participant UR as UserRepository
Admin->>C: PATCH /attendance/sessions/{sessionId}/members/{memberId}
C->>S: updateAttendanceStatus(sessionId, memberId, status, reason, adminId)
S->>UR: findById(adminId)
UR-->>S: Admin User
S-->>C: AttendanceResponse
C-->>Admin: 200 OK
sequenceDiagram
autonumber
actor Admin as 관리자
participant SC as AttendanceSessionController
participant SS as AttendanceSessionService
Admin->>SC: POST /attendance/sessions/{id}/activate
SC->>SS: activateSession(id)
SS->>SS: set startsAt = now()
SS-->>SC: SessionResponse
SC-->>Admin: 200 OK
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
backend/src/main/java/org/sejongisc/backend/attendance/controller/AttendanceController.java(4 hunks)backend/src/main/java/org/sejongisc/backend/attendance/controller/AttendanceSessionController.java(2 hunks)backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceService.java(7 hunks)backend/src/main/java/org/sejongisc/backend/attendance/service/AttendanceSessionService.java(4 hunks)backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java(1 hunks)backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java(1 hunks)backend/src/test/java/org/sejongisc/backend/attendance/controller/TestSecurityConfig.java(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Backend-CI
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
[error] 90-90: incompatible types: T has incompatible bounds; when(attendanceService.checkIn(any(UUID.class), any(AttendanceRequest.class), any(User.class)))
[error] 171-171: incompatible types: T has incompatible bounds; when(attendanceService.getAttendancesByUser(any(User.class)))
[error] 211-211: cannot find symbol: method getAttendanceBySession(UUID) in AttendanceService
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Show resolved
Hide resolved
...c/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
backend/src/main/java/org/sejongisc/backend/attendance/controller/AttendanceController.java(4 hunks)backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java(1 hunks)backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java(1 hunks)backend/src/test/java/org/sejongisc/backend/attendance/service/AttendanceServiceTest.java(9 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java (1)
WebMvcTest(32-429)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java (1)
WebMvcTest(40-310)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Backend Gate
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Show resolved
Hide resolved
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java
Show resolved
Hide resolved
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java (1)
230-230: 메서드 이름 오타 수정메서드 이름에 불필요한 't'가 포함되어 있습니다.
getActivateSessions_success를getActiveSessions_success로 수정하여 일관성을 유지하세요.- void getActivateSessions_success() throws Exception { + void getActiveSessions_success() throws Exception {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceControllerTest.java (1)
WebMvcTest(40-310)
🔇 Additional comments (1)
backend/src/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java (1)
1-44: 테스트 구조가 잘 설계되어 있습니다테스트 클래스가 다음과 같이 올바르게 구성되어 있습니다:
@WebMvcTest를 사용한 적절한 슬라이스 테스팅@Import(TestSecurityConfig.class)를 통한 보안 설정@MockitoBean을 통한 서비스 계층 모킹- 주요 엔드포인트에 대한 포괄적인 테스트 커버리지
...c/test/java/org/sejongisc/backend/attendance/controller/AttendanceSessionControllerTest.java
Show resolved
Hide resolved
discipline24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다~
4021e2b
Summary by CodeRabbit