Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
* @
* @ 수정일 수정자 수정내용
* @ --------- --------- -------------------------------
* @ 2009.03.16 최초생성
* @ 2009.03.16 최초생성
* 2026.07.14 이백행 [2026년 컨트리뷰션] 불필요한 예외 제거
*
* @author 개발프레임웍크 실행환경 개발팀
* @since 2009. 03.16
Expand All @@ -47,39 +48,35 @@ public interface EgovSampleService {
* 글을 수정한다.
* @param vo - 수정할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
void updateSample(SampleVO vo) throws Exception;
void updateSample(SampleVO vo);

/**
* 글을 삭제한다.
* @param vo - 삭제할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
void deleteSample(SampleVO vo) throws Exception;
void deleteSample(SampleVO vo);

/**
* 글을 조회한다.
* @param vo - 조회할 정보가 담긴 SampleVO
* @return 조회한 글
* @exception Exception
* @exception Exception
*/
SampleVO selectSample(SampleVO vo) throws Exception;

/**
* 글 목록을 조회한다.
* @param searchVO - 조회할 정보가 담긴 VO
* @return 글 목록
* @exception Exception
*/
List<?> selectSampleList(SampleVO vo) throws Exception;
List<?> selectSampleList(SampleVO vo);

/**
* 글 총 갯수를 조회한다.
* @param searchVO - 조회할 정보가 담긴 VO
* @return 글 총 갯수
* @exception
*/
int selectSampleListTotCnt(SampleVO vo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
* @
* @ 수정일 수정자 수정내용
* @ --------- --------- -------------------------------
* @ 2009.03.16 최초생성
* @ 2026.06.19 [2026년 컨트리뷰션] 문자열 기반 설정 제거
* @ 2026.06.25 [2026년 컨트리뷰션] 생성자 주입으로 변경
* @ 2026.07.04 정찬영 [2026년 컨트리뷰션] 미사용 import 제거 및 @Slf4j로 로거 선언 통일
* @ 2009.03.16 최초생성
* @ 2026.06.19 [2026년 컨트리뷰션] 문자열 기반 설정 제거
* @ 2026.06.25 [2026년 컨트리뷰션] 생성자 주입으로 변경
* @ 2026.07.04 정찬영 [2026년 컨트리뷰션] 미사용 import 제거 및 @Slf4j로 로거 선언 통일
* 2026.07.14 이백행 [2026년 컨트리뷰션] 불필요한 예외 제거
*
* @author 개발프레임웍크 실행환경 개발팀
* @since 2009. 03.16
Expand Down Expand Up @@ -77,21 +78,19 @@ public void insertSample(SampleVO vo) throws Exception {
* 글을 수정한다.
* @param vo - 수정할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
@Override
public void updateSample(SampleVO vo) throws Exception {
public void updateSample(SampleVO vo) {
sampleMapper.updateSample(vo);
}

/**
* 글을 삭제한다.
* @param vo - 삭제할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
@Override
public void deleteSample(SampleVO vo) throws Exception {
public void deleteSample(SampleVO vo) {
sampleMapper.deleteSample(vo);
}

Expand All @@ -113,18 +112,16 @@ public SampleVO selectSample(SampleVO vo) throws Exception {
* 글 목록을 조회한다.
* @param vo - 조회할 정보가 담긴 VO
* @return 글 목록
* @exception Exception
*/
@Override
public List<?> selectSampleList(SampleVO vo) throws Exception {
public List<?> selectSampleList(SampleVO vo) {
return sampleMapper.selectSampleList(vo);
}

/**
* 글 총 갯수를 조회한다.
* @param vo - 조회할 정보가 담긴 VO
* @return 글 총 갯수
* @exception
*/
@Override
public int selectSampleListTotCnt(SampleVO vo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
*
* 수정일 수정자 수정내용
* ---------------- ------------ ---------------------------
* 2014.01.24 표준프레임워크센터 최초 생성
* 2026.06.19 이백행 [2026년 컨트리뷰션] 문자열 기반 설정 제거
* 2014.01.24 표준프레임워크센터 최초 생성
* 2026.06.19 이백행 [2026년 컨트리뷰션] 문자열 기반 설정 제거
* 2026.07.14 이백행 [2026년 컨트리뷰션] 불필요한 예외 제거
*
* </pre>
*/
Expand All @@ -44,47 +45,41 @@ public interface SampleMapper {
* 글을 등록한다.
* @param vo - 등록할 정보가 담긴 SampleVO
* @return 등록 결과
* @exception Exception
*/
void insertSample(SampleVO vo) throws Exception;
void insertSample(SampleVO vo);

/**
* 글을 수정한다.
* @param vo - 수정할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
void updateSample(SampleVO vo) throws Exception;
void updateSample(SampleVO vo);

/**
* 글을 삭제한다.
* @param vo - 삭제할 정보가 담긴 SampleVO
* @return void형
* @exception Exception
*/
void deleteSample(SampleVO vo) throws Exception;
void deleteSample(SampleVO vo);

/**
* 글을 조회한다.
* @param vo - 조회할 정보가 담긴 SampleVO
* @return 조회한 글
* @exception Exception
*/
SampleVO selectSample(SampleVO vo) throws Exception;
SampleVO selectSample(SampleVO vo);

/**
* 글 목록을 조회한다.
* @param vo - 조회할 정보가 담긴 VO
* @return 글 목록
* @exception Exception
*/
List<?> selectSampleList(SampleVO vo) throws Exception;
List<?> selectSampleList(SampleVO vo);

/**
* 글 총 갯수를 조회한다.
* @param vo - 조회할 정보가 담긴 VO
* @return 글 총 갯수
* @exception
*/
int selectSampleListTotCnt(SampleVO vo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
* @
* @ 수정일 수정자 수정내용
* @ --------- --------- -------------------------------
* @ 2009.03.16 최초생성
* @ 2026.07.01 [2026년 컨트리뷰션] 불필요한 import 및 ModelAttribute name 속성 제거
* @ 2009.03.16 최초생성
* @ 2026.07.01 [2026년 컨트리뷰션] 불필요한 import 및 ModelAttribute name 속성 제거
* 2026.07.14 이백행 [2026년 컨트리뷰션] 불필요한 예외 제거
*
* @author 개발프레임웍크 실행환경 개발팀
* @since 2009. 03.16
Expand All @@ -65,7 +66,7 @@ public class EgovSampleController {
private final EgovPropertyService propertiesService;

@GetMapping("/")
public String index(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Exception {
public String index(@ModelAttribute SampleVO sampleVO, ModelMap model) {
return this.selectSampleList(sampleVO, model);
}

Expand All @@ -74,10 +75,9 @@ public String index(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Ex
* @param sampleVO - 조회할 정보가 담긴 SampleDefaultVO
* @param model
* @return "egovSampleList"
* @exception Exception
*/
@GetMapping("/egovSampleList.do")
public String selectSampleList(@ModelAttribute SampleVO sampleVO, ModelMap model) throws Exception {
public String selectSampleList(@ModelAttribute SampleVO sampleVO, ModelMap model) {

/** EgovPropertyService.sample */
sampleVO.setPageUnit(propertiesService.getInt("pageUnit"));
Expand Down Expand Up @@ -112,10 +112,9 @@ public String selectSampleList(@ModelAttribute SampleVO sampleVO, ModelMap model
* @param sampleVO - 목록 조회조건 정보가 담긴 VO
* @param model
* @return "egovSampleRegister"
* @exception Exception
*/
@PostMapping("/addSampleView.do")
public String addSampleView( @ModelAttribute SampleVO sampleVO, Model model) throws Exception {
public String addSampleView( @ModelAttribute SampleVO sampleVO, Model model) {

model.addAttribute("sampleVO", sampleVO);

Expand Down Expand Up @@ -168,11 +167,10 @@ public String updateSampleView(@ModelAttribute SampleVO sampleVO, Model model) t
* @param sampleVO - 수정할 정보가 담긴 VO
* @param status
* @return "forward:/egovSampleList.do"
* @exception Exception
*/
@PostMapping("/updateSample.do")
public String updateSample(@Valid @ModelAttribute SampleVO sampleVO, BindingResult bindingResult,
Model model, RedirectAttributes redirectAttributes, SessionStatus status) throws Exception {
Model model, RedirectAttributes redirectAttributes, SessionStatus status) {

if (bindingResult.hasErrors()) {
model.addAttribute("sampleVO", sampleVO);
Expand All @@ -194,10 +192,9 @@ public String updateSample(@Valid @ModelAttribute SampleVO sampleVO, BindingResu
* @param sampleVO - 삭제할 정보가 담긴 VO
* @param status
* @return "forward:/egovSampleList.do"
* @exception Exception
*/
@PostMapping("/deleteSample.do")
public String deleteSample(@ModelAttribute SampleVO sampleVO, RedirectAttributes redirectAttributes, SessionStatus status) throws Exception {
public String deleteSample(@ModelAttribute SampleVO sampleVO, RedirectAttributes redirectAttributes, SessionStatus status) {

sampleService.deleteSample(sampleVO);
status.setComplete();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package egovframework.example.exception;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -31,27 +32,29 @@ void setUp() {

@Test
@DisplayName("doAfterThrowingExceptionTransferService - ExceptionTransfer.transfer 위임 확인")
void testDoAfterThrowingDelegatesToExceptionTransfer() throws Exception {
void testDoAfterThrowingDelegatesToExceptionTransfer() {
JoinPoint joinPoint = mock(JoinPoint.class);
Exception ex = new RuntimeException("서비스 예외");

exceptionTransfer.doAfterThrowingExceptionTransferService(joinPoint, ex);

verify(mockExceptionTransfer).transfer(eq(joinPoint), eq(ex));
assertDoesNotThrow(() -> {
exceptionTransfer.doAfterThrowingExceptionTransferService(joinPoint, ex);
verify(mockExceptionTransfer).transfer(eq(joinPoint), eq(ex));
});
}

@Test
@DisplayName("setExceptionTransfer - 의존성 주입 후 transfer 호출 가능")
void testSetExceptionTransfer() throws Exception {
void testSetExceptionTransfer() {
ExceptionTransfer another = mock(ExceptionTransfer.class);
exceptionTransfer.setExceptionTransfer(another);

JoinPoint joinPoint = mock(JoinPoint.class);
Exception ex = new IllegalStateException("상태 예외");

exceptionTransfer.doAfterThrowingExceptionTransferService(joinPoint, ex);

verify(another).transfer(any(JoinPoint.class), eq(ex));
assertDoesNotThrow(() -> {
exceptionTransfer.doAfterThrowingExceptionTransferService(joinPoint, ex);
verify(another).transfer(any(JoinPoint.class), eq(ex));
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package egovframework.example.sample.service.impl;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.doNothing;
Expand Down Expand Up @@ -72,7 +73,7 @@ void setUp() {

@Test
@DisplayName("글 수정 - 정상적으로 updateSample을 호출한다")
void updateSample_정상() throws Exception {
void updateSample_정상() {
// given
doNothing().when(sampleMapper).updateSample(sampleVO);

Expand All @@ -85,7 +86,7 @@ void setUp() {

@Test
@DisplayName("글 삭제 - 정상적으로 deleteSample을 호출한다")
void deleteSample_정상() throws Exception {
void deleteSample_정상() {
// given
doNothing().when(sampleMapper).deleteSample(sampleVO);

Expand All @@ -98,15 +99,15 @@ void setUp() {

@Test
@DisplayName("글 단건 조회 - 존재하는 글을 정상적으로 반환한다")
void selectSample_정상() throws Exception {
void selectSample_정상() {
// given
SampleVO expected = new SampleVO();
expected.setId("SAMPLE-001");
expected.setName("테스트 카테고리");
when(sampleMapper.selectSample(sampleVO)).thenReturn(expected);

// when
SampleVO result = sut.selectSample(sampleVO);
SampleVO result = assertDoesNotThrow(() -> sut.selectSample(sampleVO));

// then
assertNotNull(result);
Expand All @@ -116,7 +117,7 @@ void setUp() {

@Test
@DisplayName("글 단건 조회 - 데이터가 없으면 예외가 발생한다")
void selectSample_데이터없음_예외() throws Exception {
void selectSample_데이터없음_예외() {
// given
when(sampleMapper.selectSample(sampleVO)).thenReturn(null);

Expand All @@ -127,7 +128,7 @@ void setUp() {
@Test
@DisplayName("글 목록 조회 - 목록을 정상적으로 반환한다")
@SuppressWarnings("unchecked")
void selectSampleList_정상() throws Exception {
void selectSampleList_정상() {
// given
SampleVO item1 = new SampleVO();
item1.setId("SAMPLE-001");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package egovframework.example.sample.service.impl;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import java.time.LocalDateTime;

Expand Down Expand Up @@ -34,7 +35,7 @@ class EgovSampleServiceImplTestInsertSampleTest {
private EgovSampleService egovSampleService;

@Test
void test() throws Exception {
void test() {
// given
final SampleVO sampleVO = new SampleVO();

Expand All @@ -54,10 +55,10 @@ void test() throws Exception {
sampleVO.setRegUser("eGov");

// when
egovSampleService.insertSample(sampleVO);
assertDoesNotThrow(() -> egovSampleService.insertSample(sampleVO));

// then
final SampleVO resultSampleVO = egovSampleService.selectSample(sampleVO);
final SampleVO resultSampleVO = assertDoesNotThrow(() -> egovSampleService.selectSample(sampleVO));

if (log.isDebugEnabled()) {
log.debug("sampleVO={}", sampleVO);
Expand All @@ -81,4 +82,4 @@ private void asserts(final SampleVO sampleVO, final SampleVO resultSampleVO) {
assertEquals(sampleVO.getRegUser(), resultSampleVO.getRegUser(), "글을 등록한다. 등록자");
}

}
}
Loading