@Test
public void testUnsupportedReduceContainerRequirement() throws Exception {

  final Resource maxContainerSupported = Resource.newInstance(1, 1);
  final ApplicationId appId = ApplicationId.newInstance(1, 1);
  final ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(
      appId, 1);
  final JobId jobId =
      MRBuilderUtils.newJobId(appAttemptId.getApplicationId(), 0);
  final MockScheduler mockScheduler = new MockScheduler(appAttemptId);
  final Configuration conf = new Configuration();
  final MyContainerAllocator allocator = new MyContainerAllocator(null,
      conf, appAttemptId, mock(Job.class), SystemClock.getInstance()) {
    @Override
    protected void register() {
    }
    @Override
    protected ApplicationMasterProtocol createSchedulerProxy() {
      return mockScheduler;
    }
    @Override
    protected Resource getMaxContainerCapability() {
      return maxContainerSupported;
    }
  };
  final int memory = (int) (maxContainerSupported.getMemorySize() + 10);
  ContainerRequestEvent reduceRequestEvt = createRequest(jobId, 0,
          Resource.newInstance(memory,
          maxContainerSupported.getVirtualCores()),
          new String[0], false, true);
  allocator.sendRequests(Arrays.asList(reduceRequestEvt));
  // Reducer container requests are added to the pending queue upon request,
  // schedule all reducers here so that we can observe if reducer requests
  // are accepted by RMContainerAllocator on RM side.
  allocator.scheduleAllReduces();
  allocator.schedule();
  Assert.assertEquals(0, mockScheduler.lastAnyAskReduce);
}