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.
작업 이유
작업 사항
API Spec
DELETE /v2/spending-categories/{categoryId}
결과 응답
테스트 결과
리뷰어가 중점적으로 확인해야 하는 부분
@OnDelete
등과 같은 방법을 통해 DDL을 통한 연쇄 삭제를 사용할 것인지 아니면 비즈니스 로직에서 직접 연쇄 삭제를 구현해야 할지 고민하다가 일단은 조금더 명시적인 방법인 후자를 택했습니다.어떤 방법이 더 좋을지 의견주시면 의논 후 반영토록 하겠습니다.
발견한 이슈
단위 테스트를 작성해보려 했으나... 삭제 행위에 있어서 단위테스트가 의미가 없다고 판단했습니다.
삭제 동작 같은 경우에는 실제로 DB에서 데이터가 제거가 되었는지? 가 중심적인 관심사인데, 단위 테스트를 진행하면 Mock 객체의 동작(여기서는 DAO계층의 동작) 결과를 개발자가 전부 직접 제공해주어야 하기 때문입니다.
혹시나 이런 상황에서 의미있는 단위테스트를 작성할 수 있는 방법이 있으면 알려주시면 감사하겠습니다 :)