RemoteTaskServiceImpl extends AbstractKieServerService implements TaskService { @Override public TaskSummary getTask(String serverTemplateId, String containerId, Long taskId) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return null; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); try { TaskInstance task = client.findTaskById(taskId); return new TaskSummaryMapper().apply(task); } catch (KieServicesHttpException kieException) { if (kieException.getHttpCode() == NOT_FOUND_ERROR_CODE) { return null; } else { throw kieException; } } }  @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 getTask_ReturnsNoneTasksTest() { final long taskId = 1l; final String serverTemplateId = "serverTemplateId"; when(userTaskServicesClient.findTaskById(any())).thenReturn(null); TaskSummary taskSummary = remoteTaskService.getTask(serverTemplateId, "containerId", taskId); verify(userTaskServicesClient).findTaskById(taskId); assertNull(taskSummary); }