JobInfo { public String getFormattedStartTimeStr(final DateFormat dateFormat) { String str = NA; if (startTime >= 0) { str = dateFormat.format(new Date(startTime)); } return str; } JobInfo();  JobInfo(Job job); long getNumMaps(); long getNumReduces(); Long getAvgMapTime(); Long getAvgReduceTime(); Long getAvgShuffleTime(); Long getAvgMergeTime(); Integer getFailedReduceAttempts(); Integer getKilledReduceAttempts(); Integer getSuccessfulReduceAttempts(); Integer getFailedMapAttempts(); Integer getKilledMapAttempts(); Integer getSuccessfulMapAttempts(); ArrayList<ConfEntryInfo> getAcls(); int getReducesCompleted(); int getReducesTotal(); int getMapsCompleted(); int getMapsTotal(); String getState(); String getUserName(); String getName(); String getQueueName(); String getId(); long getSubmitTime(); long getStartTime(); String getFormattedStartTimeStr(final DateFormat dateFormat); String getStartTimeStr(); long getFinishTime(); Boolean isUber(); String getDiagnostics();  }
@Test public void testGetFormattedStartTimeStr() { JobReport jobReport = mock(JobReport.class); when(jobReport.getStartTime()).thenReturn(-1L); Job job = mock(Job.class); when(job.getReport()).thenReturn(jobReport); when(job.getName()).thenReturn("TestJobInfo"); when(job.getState()).thenReturn(JobState.SUCCEEDED); JobId jobId = MRBuilderUtils.newJobId(1L, 1, 1); when(job.getID()).thenReturn(jobId); DateFormat dateFormat = new SimpleDateFormat(); JobInfo jobInfo = new JobInfo(job); Assert.assertEquals( JobInfo.NA, jobInfo.getFormattedStartTimeStr(dateFormat)); Date date = new Date(); when(jobReport.getStartTime()).thenReturn(date.getTime()); jobInfo = new JobInfo(job); Assert.assertEquals( dateFormat.format(date), jobInfo.getFormattedStartTimeStr(dateFormat)); }