@Test
public void testFinishMulitpleApplicationMastersInParallel()
    throws Exception {

  int numberOfRequests = 5;
  ArrayList<String> testContexts = new ArrayList<String>();
  LOG.info("Creating " + numberOfRequests + " contexts for testing");
  for (int i = 0; i < numberOfRequests; i++) {
    testContexts.add("test-endpoint-" + Integer.toString(i));
    LOG.info("Created test context: " + testContexts.get(i));
    RegisterApplicationMasterResponse registerResponse =
        registerApplicationMaster(i);
    Assert.assertNotNull(registerResponse);
    Assert
        .assertEquals(Integer.toString(i), registerResponse.getQueue());
  }
  finishApplicationMastersInParallel(testContexts);
}