@Test
public void testHsJobBlockForOversizeJobShouldDisplayWarningMessage() {

  int maxAllowedTaskNum = 100;
  Configuration config = new Configuration();
  config.setInt(JHAdminConfig.MR_HS_LOADED_JOBS_TASKS_MAX, maxAllowedTaskNum);
  JobHistory jobHistory =
      new JobHistoryStubWithAllOversizeJobs(maxAllowedTaskNum);
  jobHistory.init(config);
  HsJobBlock jobBlock = new HsJobBlock(jobHistory) {
    // override this so that job block can fetch a job id.
    @Override
    public Map<String, String> moreParams() {
      Map<String, String> map = new HashMap<>();
      map.put(AMParams.JOB_ID, "job_0000_0001");
      return map;
    }
  };
  // set up the test block to render HsJobBLock to
  OutputStream outputStream = new ByteArrayOutputStream();
  HtmlBlock.Block block = createBlockToCreateTo(outputStream);
  jobBlock.render(block);
  block.getWriter().flush();
  String out = outputStream.toString();
  Assert.assertTrue("Should display warning message for jobs that have too " +
      "many tasks", out.contains("Any job larger than " + maxAllowedTaskNum +
          " will not be loaded"));
}