@Test public void testAllocatedContainerResourceIsNotNull() { ArgumentCaptor<TaskAttemptContainerAssignedEvent> containerAssignedCaptor = ArgumentCaptor.forClass(TaskAttemptContainerAssignedEvent.class); @SuppressWarnings("unchecked") EventHandler<Event> eventHandler = mock(EventHandler.class); AppContext context = mock(AppContext.class) ; when(context.getEventHandler()).thenReturn(eventHandler); ContainerId containerId = ContainerId.fromString( "container_1427562107907_0002_01_000001"); LocalContainerAllocator containerAllocator = new LocalContainerAllocator( mock(ClientService.class), context, "localhost", -1, -1, containerId); ContainerAllocatorEvent containerAllocatorEvent = createContainerRequestEvent(); containerAllocator.handle(containerAllocatorEvent); verify(eventHandler, times(1)).handle(containerAssignedCaptor.capture()); Container container = containerAssignedCaptor.getValue().getContainer(); Resource containerResource = container.getResource(); Assert.assertNotNull(containerResource); Assert.assertEquals(containerResource.getMemorySize(), 0); Assert.assertEquals(containerResource.getVirtualCores(), 0); }