Skip to content

refactor: @Sql 어노테이션을 TestFactory 패턴으로 마이그레이션#557

Merged
Whale0928 merged 6 commits intomainfrom
feature/sql-to-testfactory-migration
Jan 22, 2026
Merged

refactor: @Sql 어노테이션을 TestFactory 패턴으로 마이그레이션#557
Whale0928 merged 6 commits intomainfrom
feature/sql-to-testfactory-migration

Conversation

@Whale0928
Copy link
Copy Markdown
Collaborator

Summary

  • 통합 테스트의 @SQL 어노테이션을 TestFactory 패턴으로 전환
  • init-script 폴더 삭제 (더 이상 사용되지 않는 SQL 파일)
  • 중앙 집중식 테스트 데이터 관리 체계 구축

Changes

신규 추가 (bottlenote-mono)

  • TestDataSetupHelper: 복합 테스트 데이터 생성 헬퍼
  • HistoryTestData, MyPageTestData, MyBottleTestData: 테스트용 데이터 record
  • UserTestFactory.persistUserWithNickname(): 닉네임 지정 사용자 생성 메서드

마이그레이션 (bottlenote-product-api)

테스트 파일 제거된 @SQL
PicksIntegrationTest 2
RatingIntegrationTest 3
LikesIntegrationTest 2
UserQueryIntegrationTest 9
UserCommandIntegrationTest 7
UserHistoryIntegrationTest 6
ReviewIntegrationTest 10
ReviewReplyIntegrationTest 5
JpaAuditingIntegrationTest 1
총합 45

삭제

  • bottlenote-product-api/src/test/resources/init-script/ 폴더 전체

Benefits

  • 엔티티 변경 시 컴파일 에러로 즉시 감지
  • 하드코딩된 ID 제거로 테스트 독립성 향상
  • TestFactory를 통한 중앙 집중식 데이터 관리

Test plan

  • ./gradlew integration_test 통과
  • ./gradlew check_rule_test 통과
  • ./gradlew :bottlenote-product-api:test 통과

🤖 Generated with Claude Code

Whale0928 and others added 6 commits January 22, 2026 14:34
@SQL 기반 테스트 데이터 설정을 TestFactory 패턴으로 대체하기 위한 헬퍼 클래스 추가:
- TestDataSetupHelper: 복합 테스트 데이터 생성 헬퍼
- HistoryTestData: 히스토리 테스트용 데이터 record
- MyPageTestData: 마이페이지 테스트용 데이터 record
- MyBottleTestData: 마이보틀 테스트용 데이터 record
- UserTestFactory: persistUserWithNickname 메서드 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SQL 어노테이션을 TestFactory 패턴으로 대체:
- PicksIntegrationTest: SQL 스크립트 → TestFactory 사용
- RatingIntegrationTest: SQL 스크립트 → TestFactory 사용
- LikesIntegrationTest: SQL 스크립트 → TestFactory 사용

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SQL 어노테이션을 TestFactory 패턴으로 대체:
- UserQueryIntegrationTest: TestDataSetupHelper를 활용한 복합 데이터 설정
- UserCommandIntegrationTest: TestFactory 직접 사용

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SQL 어노테이션을 TestFactory 패턴으로 대체:
- UserHistoryIntegrationTest: TestDataSetupHelper.setupHistoryTestData() 활용

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SQL 어노테이션을 TestFactory 패턴으로 대체:
- ReviewIntegrationTest: ReviewTestFactory 활용
- ReviewReplyIntegrationTest: ReviewTestFactory.persistReviewReply() 활용
- JpaAuditingIntegrationTest: TestFactory 직접 사용
- ReviewObjectFixture: getReviewCreateRequestWithAlcoholId() 메서드 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
모든 통합 테스트가 TestFactory 패턴으로 마이그레이션되어 더 이상 사용되지 않는 SQL 파일 삭제:
- init-alcohol.sql
- init-help.sql
- init-popular_alcohol.sql
- init-review-reply.sql
- init-review.sql
- init-user-history.sql
- init-user-mybottle-query.sql
- init-user-mypage-query.sql
- init-user.sql
- schema.sql.bak

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Whale0928 Whale0928 merged commit c2403f2 into main Jan 22, 2026
8 checks passed
@Whale0928 Whale0928 deleted the feature/sql-to-testfactory-migration branch January 22, 2026 05:58
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.

1 participant