RemoteTaskServiceImpl extends AbstractKieServerService implements TaskService { @Override public void completeTask(final String serverTemplateId, final String containerId, final Long taskId, final Map<String, Object> output) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); client.completeTask(containerId, taskId, identityProvider.getName(), output); taskCompletedEvent.fire(new TaskCompletedEvent(serverTemplateId, containerId, taskId)); }  @Override TaskSummary getTask(String serverTemplateId, String containerId, Long taskId); @Override TaskSummary getTaskWithSLA(String serverTemplateId, String containerId, Long taskId); @Override void updateTask(String serverTemplateId,
                           String containerId,
                           Long taskId,
                           Integer priority,
                           String description,
                           Date dueDate); @Override void claimTask(String serverTemplateId,
                          String containerId,
                          Long taskId); @Override void releaseTask(String serverTemplateId,
                            String containerId,
                            Long taskId); @Override void startTask(String serverTemplateId,
                          String containerId,
                          Long taskId); @Override void completeTask(final String serverTemplateId,
                             final String containerId,
                             final Long taskId,
                             final Map<String, Object> output); @Override void resumeTask(String serverTemplateId,
                           String containerId,
                           Long taskId); @Override void suspendTask(String serverTemplateId,
                            String containerId,
                            Long taskId); @Override void saveTaskContent(String serverTemplateId,
                                String containerId,
                                Long taskId,
                                Map<String, Object> output); @Override void addTaskComment(String serverTemplateId,
                               String containerId,
                               Long taskId,
                               String text,
                               Date addedOn); @Override void deleteTaskComment(String serverTemplateId,
                                  String containerId,
                                  Long taskId,
                                  Long commentId); @Override List<CommentSummary> getTaskComments(String serverTemplateId,
                                                String containerId,
                                                Long taskId); @Override List<TaskEventSummary> getTaskEvents(String serverTemplateId,
                                                String containerId,
                                                Long taskId,
                                                Integer page,
                                                Integer pageSize); @Override void delegate(String serverTemplateId, String containerId, Long taskId, String entity); @Override List<TaskAssignmentSummary> delegateTasks(String serverTemplateId, List<TaskKey> tasksKeyToReassign, String entity); @Override void forward(String serverTemplateId,
                        String containerId,
                        Long taskId,
                        String entity); @Override TaskAssignmentSummary getTaskAssignmentDetails(String serverTemplateId,
                                                          String containerId,
                                                          Long taskId); @Override void executeReminderForTask(String serverTemplateId,
                                       String containerId,
                                       Long taskId,
                                       String fromUser); @Override TaskSummary getTaskByWorkItemId(String serverTemplateId,
                                           String containerId,
                                           Long workItemId); static int NOT_FOUND_ERROR_CODE; }
@Test public void testTaskComplete() { final String containerId = "containerId"; final Long taskId = 1l; final String serverTemplateId = "serverTemplateId"; final Map<String, Object> output = Collections.emptyMap(); remoteTaskService.completeTask(serverTemplateId, containerId, taskId, output); verify(userTaskServicesClient).completeTask(containerId, taskId, CURRENT_USER, output); ArgumentCaptor<TaskCompletedEvent> captor = ArgumentCaptor.forClass(TaskCompletedEvent.class); verify(taskCompletedEvent).fire(captor.capture()); final TaskCompletedEvent event = captor.getValue(); assertNotNull(event); assertEquals(taskId, event.getTaskId()); assertEquals(containerId, event.getContainerId()); assertEquals(serverTemplateId, event.getServerTemplateId()); }