Skip to content

Conversation

@kamillcream
Copy link
Contributor

@kamillcream kamillcream commented Sep 19, 2025

📌 PR 개요

  • CourseService의 테스트 코드 작성

✅ 변경사항

  • 코스 생성, 조회, 즐겨찾기에 대한 테스트 코드 추가

🔍 체크리스트

  • PR 제목은 명확한가요?
  • 관련 이슈가 있다면 연결했나요?
  • 로컬 테스트는 통과했나요?
  • 코드에 불필요한 부분은 없나요?

📎 관련 이슈

Closes #98


💬 기타 참고사항

Summary by CodeRabbit

  • Tests
    • 실제 DB 롤백 환경에서 코스 추천 결과 조회, 코스 좋아요, 코스 상세 조회 시나리오 통합 테스트 추가
  • Chores
    • 테스트 전용 AssertJ 의존성 추가
  • Refactor
    • 코스, 관광지, 사용자 엔터티의 생성자 및 세터 접근 범위 조정

@kamillcream kamillcream linked an issue Sep 19, 2025 that may be closed by this pull request
@kamillcream kamillcream merged commit 5d850e9 into main Sep 19, 2025
0 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

테스트 의존성 AssertJ를 추가하고, 엔티티 생성자/세터의 가시성을 확장했으며, 코스 도메인에 대한 통합 테스트를 신규 추가했습니다. 공개 API(메서드 시그니처) 변경은 엔티티 생성자 및 User 세터 추가에 한정됩니다.

Changes

Cohort / File(s) Summary
Build config
build.gradle
testImplementation 'org.assertj:assertj-core:3.26.3' 추가
Domain entities — constructor visibility
src/main/java/com/opendata/domain/course/entity/Course.java, src/main/java/com/opendata/domain/tourspot/entity/TourSpot.java
Lombok 무인자 생성자 protected -> public; TourSpot의 모든 인자 생성자 private -> public
Domain entities — setters added
src/main/java/com/opendata/domain/user/entity/User.java
@Setter 추가로 id, membership, email, name, courseList의 public 세터 생성
Tests — CourseService integration
src/test/java/com/opendata/CourseServiceTest.java
@SpringBootTest, @Transactional 기반 통합 테스트 추가: 추천, 좋아요, 상세 조회 시나리오 검증

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant T as CourseServiceTest
  participant S as CourseService
  participant R1 as CourseRepository
  participant R2 as CourseComponentRepository

  rect rgba(200,230,255,0.3)
    note right of T: 추천 코스 조회
    T->>S: recommendCourses(lat, lon, timeWindow, place)
    S->>R1: find/retrieve candidates
    R1-->>S: courses
    S-->>T: List<CourseResponse>
  end

  rect rgba(220,255,220,0.3)
    note right of T: 코스 좋아요
    T->>S: likeCourse(userId, courseId)
    S->>R1: save/like
    R1-->>S: updated state
    S-->>T: LikeResponse
  end

  rect rgba(255,240,200,0.3)
    note right of T: 코스 상세 조회
    T->>S: fetchCourseDetail(courseId)
    S->>R1: findById(courseId)
    R1-->>S: Course
    S->>R2: findComponents(courseId)
    R2-->>S: components
    S-->>T: CourseDetailResponse
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • 7ijin01

Poem

깡총, 깡총—테스트 뜀박질!
AssertJ 품고 검증은 탄탄히.
문 여는 생성자, 살짝 더 활짝—
User의 세터는 딱딱 맞춰 착.
코스 좋아요, 상세도 확인 완료!
(•̀ᴗ•́)و ̑̑ 데이터밭에 바람 솔솔—코드는 앞으로!

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#98-course-test

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60b0d1e and a8afeac.

📒 Files selected for processing (5)
  • build.gradle (1 hunks)
  • src/main/java/com/opendata/domain/course/entity/Course.java (1 hunks)
  • src/main/java/com/opendata/domain/tourspot/entity/TourSpot.java (1 hunks)
  • src/main/java/com/opendata/domain/user/entity/User.java (1 hunks)
  • src/test/java/com/opendata/CourseServiceTest.java (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kamillcream kamillcream deleted the feat/#98-course-test branch September 19, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 코스 테스트 코드 작성

2 participants