Refactor: Phrase 도메인 관련 리팩터링 및 테스트 커버리지 성능 개선 #44
Merged
Conversation
- Phrase 도메인 관련 코드를 수정했습니다. - 기존에 20개씩 DB에서 랜덤으로 가져왔던 코드를 보다 더 확장성 있게 매개변수로 가져올 개수를 받을 수 있도록 수정했습니다. - 가져올 문장의 개수는 utils/CommonConstant 파일에 따로 분리하여 전역으로 관리할 수 있도록 했습니다. issue #36
- jacoco 테스트 커버리지 결과를 통해 검증하지 못했던 부분의 테스트를 진행했습니다. - DB에서 가져온 Phrase 객체 리스트를 from 메서드를 통해서 PhraseResponse 객체 리스트로 변환하는 과정을 검증합니다. issue #41
Contributor
There was a problem hiding this comment.
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
This was
linked to
issues
Jun 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#️⃣ 연관된 이슈
#36 #41
📝 작업 내용
📍 개선 사항
수정 전
수정 후
💬 리뷰 요구사항