public Progress getSortPhase() {
    return sortPhase;
  }
@Test
  public void testSpillFilesCountLimitInvalidValue() throws Exception {
    JobConf conf = new JobConf();
    conf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "077");
    conf.set(MRConfig.LOCAL_DIR, testRootDir.getAbsolutePath());
    conf.setInt(MRJobConfig.SPILL_FILES_COUNT_LIMIT, -2);
    MapOutputFile mof = new MROutputFiles();
    mof.setConf(conf);
    TaskAttemptID attemptId = new TaskAttemptID("12345", 1, TaskType.MAP, 1, 1);
    MapTask mockTask = mock(MapTask.class);
    doReturn(mof).when(mockTask).getMapOutputFile();
    doReturn(attemptId).when(mockTask).getTaskID();
    doReturn(new Progress()).when(mockTask).getSortPhase();
    TaskReporter mockReporter = mock(TaskReporter.class);
    doReturn(new Counter()).when(mockReporter).getCounter(any(TaskCounter.class));
    MapOutputCollector.Context ctx = new MapOutputCollector.Context(mockTask, conf, mockReporter);
    MapOutputBuffer<Object, Object> mob = new MapOutputBuffer<>();

    exception.expect(IOException.class);
    exception.expectMessage("Invalid value for \"mapreduce.task.spill.files.count.limit\", " +
        "current value: -2");

    mob.init(ctx);
    mob.close();
  }