feat(report): 신고 시스템 공통 인프라 구축 refs #29 #31
Merged
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.
목적
신고 시스템 구현에 앞서 필수적인 공통 인프라를 구축합니다.
변경 요약
1. Snowflake 기반 ID 생성기 구현
파일:
report/utils/Snowflake.java,report/utils/IdGenerator.java,report/config/IdConfig.java필요성:
핵심 구현:
2. 도메인 예외 처리 체계 구축
파일:
report/exceptions/ErrorCode.java,report/exceptions/ReportException.java,report/handler/GlobalExceptionHandler.java필요성:
ErrorCodeenum에만 추가하면 되어 유지보수성 향상핵심 구현:
ErrorCodeenum: 에러 코드, 메시지, HTTP 상태를 한곳에서 관리ReportException: ErrorCode를 감싸는 비즈니스 예외 클래스GlobalExceptionHandler:@ControllerAdvice로 모든 컨트롤러의 예외를 중앙 집중 처리3. 테스트 코드 작성
파일:
*Test.java(각 컴포넌트별 단위 테스트)SnowflakeTest: 버스트 환경(10,000회)에서 ID 유일성, 증가성, 양수 보장 검증IdConfigTest: Spring Bean 등록 및 정상 동작 확인ReportExceptionTest: 예외 객체의 상태, 코드, 메시지 노출 검증GlobalExceptionHandlerTest: 예외를 올바른 HTTP 응답으로 변환하는지 검증수용 기준 검증
브레이킹/마이그레이션
테스트
단위 테스트
수동 검증
신고 API 구현 시:
참조