WorkflowTaskAssigneesSupplier implements Supplier<List<WorkflowTaskAssignee>> { @Override public List<WorkflowTaskAssignee> get() { List<KaleoTaskAssignmentInstance> kaleoTaskAssignmentInstances = _kaleoTaskInstanceToken.getKaleoTaskAssignmentInstances(); List<WorkflowTaskAssignee> workflowTaskAssignees = new ArrayList<>( kaleoTaskAssignmentInstances.size()); for (KaleoTaskAssignmentInstance kaleoTaskAssignmentInstance : kaleoTaskAssignmentInstances) { WorkflowTaskAssignee workflowTaskAssignee = new WorkflowTaskAssignee( kaleoTaskAssignmentInstance.getAssigneeClassName(), kaleoTaskAssignmentInstance.getAssigneeClassPK()); workflowTaskAssignees.add(workflowTaskAssignee); } return workflowTaskAssignees; } WorkflowTaskAssigneesSupplier(
		KaleoTaskInstanceToken kaleoTaskInstanceToken); @Override List<WorkflowTaskAssignee> get();  }
@Test public void testGetWhenKaleoTaskAssignmentsIsEmpty() { KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoRuntimeTestUtil.mockKaleoTaskInstanceToken(); WorkflowTaskAssigneesSupplier workflowTaskAssigneesSupplier = new WorkflowTaskAssigneesSupplier(kaleoTaskInstanceToken); List<WorkflowTaskAssignee> workflowTaskAssignees = workflowTaskAssigneesSupplier.get(); Assert.assertTrue( workflowTaskAssignees.toString(), workflowTaskAssignees.isEmpty()); }
@Test public void testGetWhenKaleoTaskAssignmentsIsNotEmpty() { KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoRuntimeTestUtil.mockKaleoTaskInstanceToken( new KaleoTaskAssignmentInstance[] { KaleoRuntimeTestUtil.mockKaleoTaskAssignmentInstance( Role.class.getName(), 1), KaleoRuntimeTestUtil.mockKaleoTaskAssignmentInstance( User.class.getName(), 2) }); WorkflowTaskAssigneesSupplier workflowTaskAssigneesSupplier = new WorkflowTaskAssigneesSupplier(kaleoTaskInstanceToken); List<WorkflowTaskAssignee> workflowTaskAssignees = workflowTaskAssigneesSupplier.get(); int actualSize = workflowTaskAssignees.size(); Assert.assertEquals(2, actualSize); KaleoRuntimeTestUtil.assertWorkflowTaskAssignee( Role.class.getName(), 1, workflowTaskAssignees.get(0)); KaleoRuntimeTestUtil.assertWorkflowTaskAssignee( User.class.getName(), 2, workflowTaskAssignees.get(1)); }