AppContext appContext = mock(AppContext.class);
Configuration conf = new Configuration(false);
conf.setInt(TezConfiguration.TEZ_AM_MAX_TASK_FAILURES_PER_NODE, 2);
TestEventHandler handler = new TestEventHandler();
AMNodeMap amNodeMap = new AMNodeMap(handler, appContext);
AMContainerMap amContainerMap = mock(AMContainerMap.class);
TaskSchedulerEventHandler taskSchedulerEventHandler =
mock(TaskSchedulerEventHandler.class);
dispatcher.register(AMNodeEventType.class, amNodeMap);
dispatcher.register(AMContainerEventType.class, amContainerMap);
dispatcher.register(AMSchedulerEventType.class, taskSchedulerEventHandler);