Test: 알림 시스템 기본 인프라 테스트 (#155) #185
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📌 개요
알림 시스템 와이어프레임 확인 후 발신자 정보 추가 및 전체 테스트 코드 작성
🔨 작업 내용
1. 엔티티 / DTO 수정
Notification 엔티티
User actor필드 추가 (발신자 정보)user→receiver변수명 변경 (수신자 명확화)status필드 제거 (NotificationRead로 읽음 관리 통일)actor파라미터 추가DTO 추가/수정
ActorDto공통 DTO 생성 (발신자 정보: userId, username, profileImageUrl)ActorDto추가NotificationCreateRequest에actorId필드 추가2. Repository 수정
notification.user→notification.receiver로 변경3. Service 수정
actor파라미터 추가validateActorAndReceiver()검증 메서드 추가 (자기 자신에게 알림 방지)markAsRead()강화isVisibleToUser)NOTIFICATION_ALREADY_READ)4. Controller 수정
5. 테스트 코드 작성/수정
NotificationRepositoryTest: 모든 알림 생성 시 actor 파라미터 추가, ROOM 알림 조회 테스트 통과 확인NotificationServiceTest: actor 추가, 자기 자신에게 알림 전송 시 예외 테스트 추가, 이미 읽은 알림 읽음 처리 시 예외 테스트 수정NotificationWebSocketServiceTest: NotificationWebSocketDto.from() 사용 방식 변경 (Notification 객체 전달)NotificationControllerTest(신규)🔗 관련 이슈
Closes #155
📝 참고 사항
주요 변경 이유
아키텍처 개선
주의사항
=> 프로그램 실행 전 Q클래스 재생성 필요 (
./gradlew clean compileJava)✅ 체크리스트