PeopleAssignmentHelper { protected InternalPeopleAssignments getNullSafePeopleAssignments(Task task) { InternalPeopleAssignments peopleAssignments = (InternalPeopleAssignments) task.getPeopleAssignments(); if (peopleAssignments == null) { peopleAssignments = (InternalPeopleAssignments) TaskModelProvider.getFactory().newPeopleAssignments(); peopleAssignments.setPotentialOwners(new ArrayList<OrganizationalEntity>()); peopleAssignments.setBusinessAdministrators(new ArrayList<OrganizationalEntity>()); peopleAssignments.setExcludedOwners(new ArrayList<OrganizationalEntity>()); peopleAssignments.setRecipients(new ArrayList<OrganizationalEntity>()); peopleAssignments.setTaskStakeholders(new ArrayList<OrganizationalEntity>()); } return peopleAssignments; } PeopleAssignmentHelper();  PeopleAssignmentHelper(String separator);  PeopleAssignmentHelper(String adminUser, String adminGroup);  PeopleAssignmentHelper(CaseData caseFile); void handlePeopleAssignments(WorkItem workItem, InternalTask task, InternalTaskData taskData); static final String ACTOR_ID; static final String GROUP_ID; static final String BUSINESSADMINISTRATOR_ID; static final String BUSINESSADMINISTRATOR_GROUP_ID; static final String TASKSTAKEHOLDER_ID; static final String EXCLUDED_OWNER_ID; static final String RECIPIENT_ID; static final String DEFAULT_ADMIN_USER; static final String DEFAULT_ADMIN_GROUP; }
@Test public void testgetNullSafePeopleAssignments() { Task task = TaskModelProvider.getFactory().newTask(); InternalPeopleAssignments peopleAssignment = peopleAssignmentHelper.getNullSafePeopleAssignments(task); assertNotNull(peopleAssignment); peopleAssignment = peopleAssignmentHelper.getNullSafePeopleAssignments(task); assertNotNull(peopleAssignment); ((InternalTask) task).setPeopleAssignments(null); peopleAssignment = peopleAssignmentHelper.getNullSafePeopleAssignments(task); assertNotNull(peopleAssignment); assertEquals(0, peopleAssignment.getPotentialOwners().size()); assertEquals(0, peopleAssignment.getBusinessAdministrators().size()); assertEquals(0, peopleAssignment.getExcludedOwners().size()); assertEquals(0, peopleAssignment.getRecipients().size()); assertEquals(0, peopleAssignment.getTaskStakeholders().size()); }