CLI extends Configured implements Tool { private void listEvents(Job job, int fromEventId, int numEvents) throws IOException, InterruptedException { TaskCompletionEvent[] events = job. getTaskCompletionEvents(fromEventId, numEvents); System.out.println("Task completion events for " + job.getJobID()); System.out.println("Number of events (from " + fromEventId + ") are: " + events.length); for(TaskCompletionEvent event: events) { System.out.println(event.getStatus() + " " + event.getTaskAttemptId() + " " + getTaskLogURL(event.getTaskAttemptId(), event.getTaskTrackerHttp())); } } CLI();  CLI(Configuration conf); int run(String[] argv); void displayJobList(JobStatus[] jobs); @Private void displayJobList(JobStatus[] jobs, PrintWriter writer); static void main(String[] argv); @Private
  static String headerPattern; @Private
  static String dataPattern; }
@Test public void testListEvents() throws Exception { Cluster mockCluster = mock(Cluster.class); CLI cli = spy(new CLI(new Configuration())); doReturn(mockCluster).when(cli).createCluster(); String jobId1 = "job_1234654654_001"; String jobId2 = "job_1234654656_002"; Job mockJob1 = mockJob(mockCluster, jobId1, State.RUNNING); int exitCode = cli.run(new String[]{"-events", jobId2, "0", "10"}); assertEquals(-1, exitCode); }