Skip to content

Refactor: Phrase 도메인 관련 리팩터링 및 테스트 커버리지 성능 개선 #44

Merged
Bumnote merged 3 commits intodevfrom
refactor/phrase
Jun 27, 2025
Merged

Refactor: Phrase 도메인 관련 리팩터링 및 테스트 커버리지 성능 개선 #44
Bumnote merged 3 commits intodevfrom
refactor/phrase

Conversation

@Bumnote
Copy link
Copy Markdown
Member

@Bumnote Bumnote commented Jun 27, 2025

#️⃣ 연관된 이슈

#36 #41

📝 작업 내용

  • 20개의 문장을 데이터베이스에서 받아오는 메서드를 확장성을 고려하여 가져올 문장의 개수를 파라미터 방식으로 가져오게끔 수정했습니다.
    • 이에 대한 기능 검증 테스트 또한 진행했습니다.
  • Jacoco 테스트 커버리지 성능 결과를 토대로 테스트를 보강하여 성능을 향상시켰습니다.

📍 개선 사항

  • Jacoco 테스트 커버리지 성능을 향상시켰습니다.
    • 구문 커버리지 성능을 1% 향상시켰습니다. (71% -> 72%)

수정 전

image

수정 후

image


💬 리뷰 요구사항

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요


Bumnote added 2 commits June 27, 2025 15:14
- Phrase 도메인 관련 코드를 수정했습니다.
- 기존에 20개씩 DB에서 랜덤으로 가져왔던 코드를 보다 더 확장성 있게 매개변수로 가져올 개수를 받을 수 있도록 수정했습니다.
- 가져올 문장의 개수는 utils/CommonConstant 파일에 따로 분리하여 전역으로 관리할 수 있도록 했습니다.

issue #36
- jacoco 테스트 커버리지 결과를 통해 검증하지 못했던 부분의 테스트를 진행했습니다.
- DB에서 가져온 Phrase 객체 리스트를 from 메서드를 통해서 PhraseResponse 객체 리스트로 변환하는 과정을 검증합니다.

issue #41
@Bumnote Bumnote requested review from Copilot and kyubumjang June 27, 2025 18:28
@Bumnote Bumnote self-assigned this Jun 27, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Phrase domain to support dynamic retrieval of a configurable number of random phrases and improves test coverage and performance in related tests.

  • Updated PhraseRepository and its interface to use a parameterized method for retrieving phrases.
  • Refactored tests (including parameterized tests in PhraseRepositoryTest and added PhraseServiceTest) to validate the changes.
  • Adjusted constants in CommonConstant and removed an unused test profile annotation in LuckyMessageServiceTest.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/test/java/dasi/typing/domain/phrase/PhraseRepositoryTest.java Updated test to use parameterized testing for various phrase counts.
src/test/java/dasi/typing/api/service/phrase/PhraseServiceTest.java Added test to validate conversion from Phrase to PhraseResponse; note the use of getFirst().
src/test/java/dasi/typing/api/service/phrase/LuckyMessageServiceTest.java Removed ActiveProfiles annotation; confirm that the default configuration suffices.
src/main/java/dasi/typing/utils/CommonConstant.java Updated JWT numeric literals for clarity and introduced PHRASE_COUNT constant.
src/main/java/dasi/typing/domain/phrase/PhraseRepositoryImpl.java Changed method signature to accept a phraseCount parameter supporting dynamic limits.
src/main/java/dasi/typing/domain/phrase/PhraseRepositoryCustom.java Updated interface to reflect the new parameterized phrase retrieval approach.
src/main/java/dasi/typing/api/service/phrase/PhraseService.java Modified service method to use the PHRASE_COUNT constant when retrieving phrases.
Comments suppressed due to low confidence (1)

src/test/java/dasi/typing/api/service/phrase/LuckyMessageServiceTest.java:10

  • The removal of the @activeprofiles annotation may affect the intended test configuration; please verify that the correct profiles are loaded for these tests.
@SpringBootTest

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.

[Dev] Jacoco Test Coverage 측정 및 개선 [Test] 전반적인 테스트 코드 보완 및 Spring REST Docs 적용

2 participants