Skip to content

[Refactor] StudyRoom 도메인 테스트 작성 및 서비스 구조 변경#124

Open
zosungwoo wants to merge 5 commits intodevfrom
refactor/#123
Open

[Refactor] StudyRoom 도메인 테스트 작성 및 서비스 구조 변경#124
zosungwoo wants to merge 5 commits intodevfrom
refactor/#123

Conversation

@zosungwoo
Copy link
Contributor

@zosungwoo zosungwoo commented Mar 7, 2025

📄 Description

📌 구현 내용

  • StudyRoomService를 인터페이스와 구현체로 분리 (범준님 코멘트 참고함)
  • StudyRoom 도메인의 엔티티, 컨트롤러에 대한 테스트 작성
  • StudyTimeRepository에 JPQL 문법 오류를 발견하여 수정

✅ PR 포인트

  • 컨트롤러에서 필드 검증과 같은 유효성 체크를 수행하고 서비스는 비즈니스 로직을 담당하는 것이 책임 분리에 적절하다고 판단하여, 서비스 단의 DTO 검증 로직을 제거하고 컨트롤러에서 검증하도록 하였습니다.
  • generateCodeFailed 메서드에서는 ReflectionTestUtils를 활용해 studyRoomService의 connectionCodeRepository를 테스트를 위해 임시로 Mock 객체로 교체하였습니다. '@Autowired로 주입된 studyRoomService'의 내부 필드를 테스트 목적으로 수정할 수 있었습니다. (생성자 주입이나 Setter 주입을 통해 의존성을 교체할 수 있다고 합니다. 또는 추후에 설계를 바꿔 Mock을 사용하지 않는 방향으로 구현할 수 있을지 고민해봐야겠습니다.)

@zosungwoo zosungwoo added ⭐️ Feature New feature or request 🪄Refactor ⚙️Test and removed ⭐️ Feature New feature or request labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] StudyRoom 도메인 테스트 작성 및 구조 개선

1 participant