Skip to content

refactor(sample): 불필요한 예외 제거#61

Closed
LeeBaekHaeng wants to merge 2 commits into
eGovFramework:mainfrom
itcen-entec-2026:refactor/remove-throws-all
Closed

refactor(sample): 불필요한 예외 제거#61
LeeBaekHaeng wants to merge 2 commits into
eGovFramework:mainfrom
itcen-entec-2026:refactor/remove-throws-all

Conversation

@LeeBaekHaeng

@LeeBaekHaeng LeeBaekHaeng commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

수정 사유 Reason for modification

소스를 수정한 사유가 무엇인지 체크해 주세요. Please check the reason you modified the source. ([X] X는 대문자여야 합니다.)

  • 버그수정 Bug fixes
  • 기능개선 Enhancements
  • 기능추가 Adding features
  • 기타 Others

수정된 소스 내용 Modified source

검토자를 위해 수정된 소스 내용을 설명해 주세요. Please describe the modified source for reviewers.

변경 이유

  • 실제 예외를 발생시키지 않음에도 선언되어 있던 throws Exception 구문이 코드를 읽는 데 오해를 불러일으킬 수 있어 제거합니다.

작업 내용

  • 불필요한 throws Exception 선언 삭제
  • 기능 변경 없는 코드 개선

JUnit 테스트 JUnit tests

테스트를 완료하셨으면 다음 항목에 [대문자X]로 표시해 주세요. When you're done testing, check the following items.

  • JUnit 테스트 JUnit tests
  • 수동 테스트 Manual testing

테스트 브라우저 Test Browser

테스트를 진행한 브라우저를 선택해 주세요. Please select the browser(s) you ran the test on. (다중 선택 가능 you can select multiple) [X] X는 대문자여야 합니다.

  • Chrome
  • Firefox
  • Edge
  • Safari
  • Opera
  • Internet Explorer
  • 기타 Others

테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video

테스트 전과 후의 스크린샷 또는 캡처 영상을 이곳에 첨부해 주세요. Please attach screenshots or video captures of your before and after tests here.

@eGovFrameSupport

eGovFrameSupport commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

검토 결과를 공유드립니다.

먼저 src/main 쪽 변경은 정확합니다. throws Exception을 일괄 제거한 것이 아니라,
컴파일러가 강제하는 지점을 정확히 식별해 남긴 것이 확인됩니다.

  • EgovSampleServiceImplinsertSample : egovIdGnrService.getNextStringId()
    FdlException(BaseExceptionjava.lang.Exception, checked)을 던짐
  • EgovSampleServiceImplselectSample : processException(...) 호출
  • 위 두 메서드에서 파생되는 인터페이스/컨트롤러 선언

다만 아래 두 가지 이유로 이번 변경은 반영하지 않고 close 하겠습니다.

  1. 테스트의 throws Exception은 제거 대상이 아닙니다.

JUnit 5에서 테스트 메서드의 checked 예외 선언은 허용되는 표준 관용구이며, 불필요한 선언이 아닙니다.
이번 PR은 이를 제거하기 위해 13개 테스트 파일에 assertDoesNotThrow를 31곳 도입했는데, 그 과정에서 다음 문제가 발생합니다.

  • EgovAopExceptionTransferTest에서 Mockito verify() 호출이 assertDoesNotThrow
    람다 내부로 이동했습니다. verify()는 검증 실패 시 MockitoAssertionError
    던지므로, 이제 검증 실패가 "Unexpected exception thrown"으로 포장되어
    Mockito가 제공하던 기대/실제 메시지가 누락되어 테스트 실패 시 원인 파악이 어려워집니다.

  • SampleMapperTestInsertSampleTest 등에서는 given 절의 준비 코드
    (egovIdGnrService.getNextStringId())가 assertDoesNotThrow로 감싸이면서,
    테스트가 실제로 검증하려는 대상이 무엇인지 판별이 어려워집니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants