| | |
| | | /** |
| | | * {@link BpmTaskCandidateInvoker} 的单元测试 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | public class BpmTaskCandidateInvokerTest extends BaseMockitoUnitTest { |
| | | |
| | |
| | | assertEquals(asSet(1L), assigneeUserIds); |
| | | } |
| | | |
| | | @Test |
| | | public void testRemoveDisableUsers_keepDisabledUser() { |
| | | // 准备参数:2L 被禁用,但它是发起人节点需要保留的发起人;3L 找不到 |
| | | Set<Long> assigneeUserIds = asSet(1L, 2L, 3L); |
| | | // mock 方法 |
| | | AdminUserRespDTO user1 = randomPojo(AdminUserRespDTO.class, o -> o.setId(1L) |
| | | .setStatus(CommonStatusEnum.ENABLE.getStatus())); |
| | | AdminUserRespDTO user2 = randomPojo(AdminUserRespDTO.class, o -> o.setId(2L) |
| | | .setStatus(CommonStatusEnum.DISABLE.getStatus())); |
| | | Map<Long, AdminUserRespDTO> userMap = MapUtil.builder(user1.getId(), user1) |
| | | .put(user2.getId(), user2).build(); |
| | | when(adminUserApi.getUserMap(eq(assigneeUserIds))).thenReturn(userMap); |
| | | |
| | | // 调用 |
| | | taskCandidateInvoker.removeDisableUsers(assigneeUserIds, 2L); |
| | | // 断言:保留被禁用的发起人 2L,移除不存在的 3L |
| | | assertEquals(asSet(1L, 2L), assigneeUserIds); |
| | | } |
| | | |
| | | } |