### Question:
JobHistoryFileParserFactory { public static JobHistoryFileParser createJobHistoryFileParser( byte[] historyFileContents, Configuration jobConf) throws IllegalArgumentException { if (historyFileContents == null) { throw new IllegalArgumentException( "Job history contents should not be null"); } HadoopVersion version = getVersion(historyFileContents); switch (version) { case TWO: return new JobHistoryFileParserHadoop2(jobConf); default: throw new IllegalArgumentException( " Unknown format of job history file "); } }  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 testCreateJobHistoryFileParserCorrectCreation() { String jHist2 = "Avro-Json\n" + "{\"type\":\"record\",\"name\":\"Event\", " + "\"namespace\":\"org.apache.hadoop.mapreduce.jobhistory\"," + "\"fields\":[]\""; JobHistoryFileParser historyFileParser = JobHistoryFileParserFactory .createJobHistoryFileParser(jHist2.getBytes(), null); assertNotNull(historyFileParser); assertTrue(historyFileParser instanceof JobHistoryFileParserHadoop2); }
@Test(expected = IllegalArgumentException.class) public void testCreateJobHistoryFileParserNullCreation() { JobHistoryFileParser historyFileParser = JobHistoryFileParserFactory .createJobHistoryFileParser(null, null); assertNull(historyFileParser); }