private TaskSpec createBaseTaskSpec(String vertexName, TezVertexID vertexId, int taskIdx) {
      TaskSpec taskSpec = mock(TaskSpec.class);
      Configuration conf = new Configuration(false);
      HiveConf.setVar(conf, HiveConf.ConfVars.HIVE_QUERY_ID, "fakeQueryId");
      UserPayload userPayload;
      try {
        userPayload = TezUtils.createUserPayloadFromConf(conf);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      TezTaskAttemptID taskAttemptId = TezTaskAttemptID.getInstance(
          TezTaskID.getInstance(vertexId, taskIdx), 0);
      doReturn(taskAttemptId).when(taskSpec).getTaskAttemptID();
      doReturn(taskAttemptId.getDAGID()).when(taskSpec).getDAGID();
      doReturn(DAG_NAME).when(taskSpec).getDAGName();
      doReturn(vertexName).when(taskSpec).getVertexName();
      ProcessorDescriptor processorDescriptor = ProcessorDescriptor.create("fakeClassName").setUserPayload(userPayload);
      doReturn(processorDescriptor).when(taskSpec).getProcessorDescriptor();
      return taskSpec;
    }
Wrapper class which is responsible for setting up various mocks required for different tests.
llap-tez/src/test/org/apache/hadoop/hive/llap/tezplugins/TestLlapTaskCommunicator.java