FirstWorkflowTaskAssigneeSupplier implements Supplier<Optional<WorkflowTaskAssignee>> { @Override public Optional<WorkflowTaskAssignee> get() { return Optional.ofNullable( _kaleoTaskInstanceToken.getFirstKaleoTaskAssignmentInstance() ).map( kaleoTaskAssignmentInstance -> new WorkflowTaskAssignee( kaleoTaskAssignmentInstance.getAssigneeClassName(), kaleoTaskAssignmentInstance.getAssigneeClassPK()) ); } FirstWorkflowTaskAssigneeSupplier(
		KaleoTaskInstanceToken kaleoTaskInstanceToken); @Override Optional<WorkflowTaskAssignee> get();  }
@Test public void testGetWhenFirstKaleoTaskAssignmentInstanceIsNotNull() { String expectedAssigneeClassName = StringUtil.randomString(); long expectedAssigneeClassPK = RandomTestUtil.randomLong(); KaleoTaskAssignmentInstance firstKaleoTaskAssignmentInstance = KaleoRuntimeTestUtil.mockKaleoTaskAssignmentInstance( expectedAssigneeClassName, expectedAssigneeClassPK); KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoRuntimeTestUtil.mockKaleoTaskInstanceToken( firstKaleoTaskAssignmentInstance); FirstWorkflowTaskAssigneeSupplier firstWorkflowTaskAssigneeSupplier = new FirstWorkflowTaskAssigneeSupplier(kaleoTaskInstanceToken); Optional<WorkflowTaskAssignee> firstWorkflowTaskAssigneeOptional = firstWorkflowTaskAssigneeSupplier.get(); Assert.assertTrue(firstWorkflowTaskAssigneeOptional.isPresent()); KaleoRuntimeTestUtil.assertWorkflowTaskAssignee( expectedAssigneeClassName, expectedAssigneeClassPK, firstWorkflowTaskAssigneeOptional.get()); }
@Test public void testGetWhenFirstKaleoTaskAssignmentInstanceIsNull() { KaleoTaskInstanceToken kaleoTaskInstanceToken = KaleoRuntimeTestUtil.mockKaleoTaskInstanceToken(); FirstWorkflowTaskAssigneeSupplier firstWorkflowTaskAssigneeSupplier = new FirstWorkflowTaskAssigneeSupplier(kaleoTaskInstanceToken); Optional<WorkflowTaskAssignee> firstWorkflowTaskAssigneeOptional = firstWorkflowTaskAssigneeSupplier.get(); Assert.assertFalse(firstWorkflowTaskAssigneeOptional.isPresent()); }