Commit 1d3ca8a990603071f9be8ac882cf9a8bdb7008d3
1 parent
83003021
完善 TenantServiceImpl 单元测试
Showing
2 changed files
with
4 additions
and
4 deletions
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java
| ... | ... | @@ -138,7 +138,7 @@ public class TenantServiceImpl implements TenantService { |
| 138 | 138 | @Transactional(rollbackFor = Exception.class) |
| 139 | 139 | public void updateTenant(TenantUpdateReqVO updateReqVO) { |
| 140 | 140 | // 校验存在 |
| 141 | - TenantDO tenant = checkUpdateTenant(updateReqVO.getId()); | |
| 141 | + TenantDO tenant = validateUpdateTenant(updateReqVO.getId()); | |
| 142 | 142 | // 校验套餐被禁用 |
| 143 | 143 | TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId()); |
| 144 | 144 | |
| ... | ... | @@ -179,12 +179,12 @@ public class TenantServiceImpl implements TenantService { |
| 179 | 179 | @Override |
| 180 | 180 | public void deleteTenant(Long id) { |
| 181 | 181 | // 校验存在 |
| 182 | - checkUpdateTenant(id); | |
| 182 | + validateUpdateTenant(id); | |
| 183 | 183 | // 删除 |
| 184 | 184 | tenantMapper.deleteById(id); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - private TenantDO checkUpdateTenant(Long id) { | |
| 187 | + private TenantDO validateUpdateTenant(Long id) { | |
| 188 | 188 | TenantDO tenant = tenantMapper.selectById(id); |
| 189 | 189 | if (tenant == null) { |
| 190 | 190 | throw exception(TENANT_NOT_EXISTS); | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java
| ... | ... | @@ -196,7 +196,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest { |
| 196 | 196 | role100.setTenantId(dbTenant.getId()); |
| 197 | 197 | RoleDO role101 = randomPojo(RoleDO.class, o -> o.setId(101L)); |
| 198 | 198 | role101.setTenantId(dbTenant.getId()); |
| 199 | - when(roleService.getRoleList(isNull())).thenReturn(asList(role100, role101)); | |
| 199 | + when(roleService.getRoleListByStatus(isNull())).thenReturn(asList(role100, role101)); | |
| 200 | 200 | // mock 每个角色的权限 |
| 201 | 201 | when(permissionService.getRoleMenuIds(eq(101L))).thenReturn(asSet(201L, 202L)); |
| 202 | 202 | ... | ... |