### Question:
JobHistoryFileParserFactory { public static HadoopVersion getVersion(byte[] historyFileContents) { if(historyFileContents.length > HADOOP2_VERSION_LENGTH) { String version2Part = new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH); if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) { return HadoopVersion.TWO; } } throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents); }  static HadoopVersion getVersion(byte[] historyFileContents); static JobHistoryFileParser createJobHistoryFileParser(
      byte[] historyFileContents, Configuration jobConf); static HadoopVersion getHistoryFileVersion2(); static final String HADOOP2_VERSION_STRING; }### Answer:
@Test public void testGetVersion() { String jHist2 = "Avro-Json\n" + "{\"type\":\"record\",\"name\":\"Event\", " + "\"namespace\":\"org.apache.hadoop.mapreduce.jobhistory\",\"fields\":[]\""; HadoopVersion version2 = JobHistoryFileParserFactory.getVersion(jHist2.getBytes()); assertEquals(JobHistoryFileParserFactory.getHistoryFileVersion2(), version2); }
@Test(expected = IllegalArgumentException.class) public void testGetVersionIncorrect2() { String jHist2 = "Avro-HELLO-Json\n" + "{\"type\":\"record\",\"name\":\"Event\", " + "\"namespace\":\"org.apache.hadoop.mapreduce.jobhistory\",\"fields\":[]\""; JobHistoryFileParserFactory.getVersion(jHist2.getBytes()); }
@Test(expected = IllegalArgumentException.class) public void testGetVersionIncorrect1() { String jHist1 = "Meta HELLO VERSION=\"1\" .\n" + "Job JOBID=\"job_201301010000_12345\""; JobHistoryFileParserFactory.getVersion(jHist1.getBytes()); }