InternalTaskService injectedTaskServiceMock = mock(InternalTaskService.class);
// - set task instance
InternalTask task = new TaskImpl();
task.setId(TASK_ID);
task.setTaskData(new TaskDataImpl());
doThrow(new IllegalStateException("Use the getTaskById() method, which should already have been called!"))
.when(injectedTaskServiceMock).execute(any(GetTaskCommand.class));
doReturn(task).when(injectedTaskServiceMock).getTaskById(TASK_ID);