Skip to content
Merged
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 @@ -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;
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down
Loading