@Test(timeout = 10000) public void testGetContainers() throws YarnException, IOException { Configuration conf = new Configuration(); final YarnClient client = new MockYarnClient(); client.init(conf); client.start(); ApplicationId applicationId = ApplicationId.newInstance(1234, 5); ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(applicationId, 1); List<ContainerReport> reports = client.getContainers(appAttemptId); Assert.assertNotNull(reports); Assert.assertEquals( reports.get(0).getContainerId(), (ContainerId.newContainerId(appAttemptId, 1))); Assert.assertEquals( reports.get(1).getContainerId(), (ContainerId.newContainerId(appAttemptId, 2))); client.stop(); }