diff --git a/structure-ddd-template-application/src/test/java/cn/structured/template/application/service/impl/DeptServiceImplTest.java b/structure-ddd-template-application/src/test/java/cn/structured/template/application/service/impl/DeptServiceImplTest.java index cddf30c..921a7df 100644 --- a/structure-ddd-template-application/src/test/java/cn/structured/template/application/service/impl/DeptServiceImplTest.java +++ b/structure-ddd-template-application/src/test/java/cn/structured/template/application/service/impl/DeptServiceImplTest.java @@ -7,8 +7,8 @@ import cn.structured.template.domain.repository.DeptRepository; import cn.structured.template.domain.service.DeptDomainService; import cn.structured.template.common.dto.DeptDTO; -import cn.structured.template.common.enums.OrgExceptionEnum; -import cn.structured.template.common.exception.OrgException; +import cn.structured.template.common.enums.TemplateExceptionEnum; +import cn.structured.template.common.exception.TemplateException; import cn.structured.template.common.query.DeptQuery; import cn.structured.template.common.vo.DeptVO; import org.junit.jupiter.api.BeforeEach; @@ -101,10 +101,10 @@ void create_whenHasParent_shouldSetTreePath() { @Test void create_whenParentNotFound_shouldThrowException() { dto.setParentId(99L); - doThrow(new OrgException(TemplateExceptionEnum.DEPT_PARENT_NOT_FOUND)) + doThrow(new TemplateException(TemplateExceptionEnum.DEPT_PARENT_NOT_FOUND)) .when(deptDomainService).buildTreePathOnCreate(any(DeptEntity.class)); - OrgException exception = assertThrows(OrgException.class, + TemplateException exception = assertThrows(TemplateException.class, () -> deptService.create(dto)); assertEquals(TemplateExceptionEnum.DEPT_PARENT_NOT_FOUND.getCode(), exception.getCode()); @@ -124,7 +124,7 @@ void update_shouldUpdateDept() { void update_whenDeptNotFound_shouldThrowException() { when(deptRepository.findById(1L)).thenReturn(null); - OrgException exception = assertThrows(OrgException.class, + TemplateException exception = assertThrows(TemplateException.class, () -> deptService.update(1L, dto)); assertEquals(TemplateExceptionEnum.DEPT_NOT_FOUND.getCode(), exception.getCode()); @@ -163,7 +163,7 @@ void deleteByIds_shouldDeleteDepts() { void deleteByIds_whenHasChildren_shouldThrowException() { when(deptRepository.countByParentId(1L)).thenReturn(1L); - OrgException exception = assertThrows(OrgException.class, + TemplateException exception = assertThrows(TemplateException.class, () -> deptService.deleteByIds(Collections.singletonList(1L))); assertEquals(TemplateExceptionEnum.DEPT_HAS_CHILDREN.getCode(), exception.getCode()); @@ -184,7 +184,7 @@ void findById_shouldReturnDeptVO() { void findById_whenDeptNotFound_shouldThrowException() { when(deptRepository.findById(1L)).thenReturn(null); - OrgException exception = assertThrows(OrgException.class, + TemplateException exception = assertThrows(TemplateException.class, () -> deptService.findById(1L)); assertEquals(TemplateExceptionEnum.DEPT_NOT_FOUND.getCode(), exception.getCode());