@Test
public void testRemoveApplication() throws Exception {

  auxService = createCollectorAndAddApplication();
  // auxService should have a single app
  assertTrue(auxService.hasApplication(appAttemptId.getApplicationId()));
  ContainerId containerId = getAMContainerId();
  ContainerTerminationContext context =
      mock(ContainerTerminationContext.class);
  when(context.getContainerId()).thenReturn(containerId);
  when(context.getContainerType()).thenReturn(
      ContainerType.APPLICATION_MASTER);
  auxService.stopContainer(context);
  // auxService should not have that app
  assertFalse(auxService.hasApplication(appAttemptId.getApplicationId()));
  auxService.close();
}