Skip to content

Conversation

@asa9874
Copy link
Member

@asa9874 asa9874 commented Oct 26, 2025

🔍개요

  • 주문 가능 상점 전환(주문 서비스 가입) POST API 검증로직 추가 및 테스트 추가

🚀 주요 변경 내용

  • Service단에 검증 로직 추가와 이에 따라 테스트 코드를 생성했습니다.

💬 참고 사항

  • Enttiy단의 @Column 은 기능 확정된후에 작하겠습니다

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

@asa9874 asa9874 self-assigned this Oct 26, 2025
@asa9874 asa9874 added 기능 새로운 기능을 개발합니다. Team Business 비즈니스 팀에서 작업할 이슈입니다 labels Oct 26, 2025
@asa9874 asa9874 requested review from dh2906 and taejinn October 26, 2025 09:01
Copy link
Contributor

@dh2906 dh2906 left a 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);
Copy link
Contributor

Choose a reason for hiding this comment

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

리플렉션으로 id를 설정할 수도 있지만, 굳이 실제 엔티티의 내부 필드 값을 주입해야 하는 것이 아니라면 spy를 통해 getId()를 스터빙 하는 것도 좋아보입니다!

Copy link
Member Author

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 때문에 테스트 코드 자체의 가독성이 떨어질 수 있다고 생각해서 지금 방식으로 작성하였는데 이에 대해 의견 묻고싶습니다.

Copy link
Contributor

@dh2906 dh2906 Oct 27, 2025

Choose a reason for hiding this comment

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

저는 반대로 모든 테스트에서 id를 사용하지 않으니 필요한 부분에서만 사용할 수 있도록 스터빙하는 것이 맞지 않을까? 랄는 의견입니당.
이 부분은 테스트 코드의 일관성을 유지하기 위해 한 가지 방법을 정해야 할 것 같아요

Copy link
Collaborator

@Soundbar91 Soundbar91 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 !
테스트 제외한 코드에 대해서 코멘트 먼저 남기겠습니다 ~

@asa9874 asa9874 merged commit c8e0d7e into feat/2027-add-shop-to-orderable-request-api Oct 27, 2025
3 checks passed
@asa9874 asa9874 deleted the feat/2038-shop-to-orderable-request-validate branch October 27, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team Business 비즈니스 팀에서 작업할 이슈입니다 기능 새로운 기능을 개발합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants