-
Couldn't load subscription status.
- Fork 1
feat: 주문 가능 상점 전환(주문 서비스 가입) POST API 검증로직 추가 및 테스트 추가 #2048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 주문 가능 상점 전환(주문 서비스 가입) POST API 검증로직 추가 및 테스트 추가 #2048
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
작업하시느라 고생하셨습니다!
| @BeforeEach | ||
| void setUp() { | ||
| owner = OwnerFixture.성빈_사장님(); | ||
| ReflectionTestUtils.setField(owner, "id", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
리플렉션으로 id를 설정할 수도 있지만, 굳이 실제 엔티티의 내부 필드 값을 주입해야 하는 것이 아니라면 spy를 통해 getId()를 스터빙 하는 것도 좋아보입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋은 의견 감사합니다!
ReflectionTestUtils를 사용해서 private 필드에 접근하는 건 저도 위험할 수 있는 행위라고 생각합니다.
하지만 해당 테스트에서 Stub를 전역으로 사용하게 될 시 Unnecessary stubbings detected. 오류가 발생하여,
각 필요한 부분을 개별적으로 정리해야 하고, 이로 인해 테스트의 주체가 아닌 Owner 때문에 테스트 코드 자체의 가독성이 떨어질 수 있다고 생각해서 지금 방식으로 작성하였는데 이에 대해 의견 묻고싶습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 반대로 모든 테스트에서 id를 사용하지 않으니 필요한 부분에서만 사용할 수 있도록 스터빙하는 것이 맞지 않을까? 랄는 의견입니당.
이 부분은 테스트 코드의 일관성을 유지하기 위해 한 가지 방법을 정해야 할 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 !
테스트 제외한 코드에 대해서 코멘트 먼저 남기겠습니다 ~
src/main/java/in/koreatech/koin/domain/shoptoOrderable/service/ShopToOrderableService.java
Outdated
Show resolved
Hide resolved
...main/java/in/koreatech/koin/domain/shoptoOrderable/repository/ShopToOrderableRepository.java
Outdated
Show resolved
Hide resolved
src/main/java/in/koreatech/koin/global/code/ApiResponseCode.java
Outdated
Show resolved
Hide resolved
src/main/java/in/koreatech/koin/global/code/ApiResponseCode.java
Outdated
Show resolved
Hide resolved
c8e0d7e
into
feat/2027-add-shop-to-orderable-request-api
🔍개요
🚀 주요 변경 내용
💬 참고 사항
@Column은 기능 확정된후에 작하겠습니다✅ Checklist (완료 조건)