@Test
public void testGetContainerReport() throws Exception {

  final ContainerId containerId =
      ContainerId.newContainerId(ApplicationAttemptId.newInstance(
          ApplicationId.newInstance(0, 1), 1), 1);
  ContainerReport container;
  if (callerUGI == null) {
    container = historyManager.getContainer(containerId);
  } else {
    try {
      container =
          callerUGI.doAs(new PrivilegedExceptionAction<ContainerReport> () {
        @Override
        public ContainerReport run() throws Exception {
          return historyManager.getContainer(containerId);
        }
      });
      if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) {
        // The exception is expected
        Assert.fail();
      }
    } catch (AuthorizationException e) {
      if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) {
        // The exception is expected
        return;
      }
      throw e;
    }
  }
  Assert.assertNotNull(container);
  Assert.assertEquals(Integer.MAX_VALUE + 1L, container.getCreationTime());
  Assert.assertEquals(Integer.MAX_VALUE + 2L, container.getFinishTime());
  Assert.assertEquals(Resource.newInstance(-1, -1),
      container.getAllocatedResource());
  Assert.assertEquals(NodeId.newInstance("test host", 100),
      container.getAssignedNode());
  Assert.assertEquals(Priority.UNDEFINED, container.getPriority());
  Assert
      .assertEquals("test diagnostics info", container.getDiagnosticsInfo());
  Assert.assertEquals(ContainerState.COMPLETE, container.getContainerState());
  Assert.assertEquals(-1, container.getContainerExitStatus());
  Assert.assertEquals("http://0.0.0.0:8188/applicationhistory/logs/" +
      "test host:100/container_0_0001_01_000001/"
      + "container_0_0001_01_000001/user1", container.getLogUrl());
}