-
Notifications
You must be signed in to change notification settings - 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
dh2906
left a comment
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를 사용하지 않으니 필요한 부분에서만 사용할 수 있도록 스터빙하는 것이 맞지 않을까? 랄는 의견입니당.
이 부분은 테스트 코드의 일관성을 유지하기 위해 한 가지 방법을 정해야 할 것 같아요
Soundbar91
left a comment
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
* feat: 주문 가능 상점 전환(주문 서비스 가입) POST API 틀제작 (#2036) * feat: 빈 java 파일들 생성 * feat: ShopToOrderable Post를 스켈레톤코드 작성 * refact: DTO, Model 필드 생성 (임시) * feat: Controller 수정 * feat: Service, Repository 단 * refact: 컨벤션 수정 * refact: 예외코드 추가 및 수정, 엔드포인트 경로 변경, * refact: Entity 리펙토링 * refact: 미사용 import 제거 * refact: {shopId} 추가 및 개행 제거 * feat: 주문 가능 상점 전환(주문 서비스 가입) POST API 검증로직 추가 및 테스트 추가 (#2048) * feat: 검증 추가 * feat: 주문가능상점변환 테스트 추가 * refact: 매개변수 stirng -> ShopToOrderableRequestStatus로 변경 * refact: 예외 명 변경 * feat : flyway 추가 및 컬럼 명 추가 * refact : isOpen 삭제 * fix : isOpen 테스트 부분 삭제 * refact : idx제거 * refact : 형식 준수 * feat : fk_shop_to_orderable_shop 외래키 추가 * fix : approvedAt NULL 불일치 제거 * feat: 상점 @manytoone으로 변경 * feat: ShopToOrderableDeliveryOption 추가 * refact: @NotNull 추가 * refact: 검증로직 메서드화 * refact: 개행제거 * fix : flyway fk 테이블명 불일치 해결 * feat: Swagger 패키지 추가 * refact: takeout -> isTakeout 컬럼명 수정 * refact: outside_delivery_tip -> off_campus_delivery_tip 컬럼명 수정 * feat : 동시성 방지 @DuplicateGuard 추가 * refact : 가게 사장 검증로직 shop 내부 메서드로 이동 * refact: 예외 Static import처리 * refact: 도메인명 ShopOrderServiceRequest로 변경 * refact: ownershop 하위 패키지로 이동 * refact: api 문서화 리펙토링 * refact: swagger 리펙토링, 엔드포인트 리펙토링 * refact: 테이블명 리펙토링 * refact: 대문자 시작 변수네이밍 수정 * refact: 미사용 메서드 제거 * refact: 메소드 네이밍 및 static import * refact: 변수 첫글자 대문자 변경
🔍개요
🚀 주요 변경 내용
💬 참고 사항
@Column은 기능 확정된후에 작하겠습니다✅ Checklist (완료 조건)