@Test
public void testMoveAllAppsInvalidSource() throws Exception {

  MockRM rm = setUpMove();
  AbstractYarnScheduler scheduler =
      (AbstractYarnScheduler) rm.getResourceScheduler();
  // submit an app
  RMApp app = rm.submitApp(GB, "test-move-1", "user_0", null, "a1");
  ApplicationAttemptId appAttemptId =
      rm.getApplicationReport(app.getApplicationId())
          .getCurrentApplicationAttemptId();
  // check preconditions
  List<ApplicationAttemptId> appsInA1 = scheduler.getAppsInQueue("a1");
  assertEquals(1, appsInA1.size());
  List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.contains(appAttemptId));
  assertEquals(1, appsInA.size());
  List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());
  List<ApplicationAttemptId> appsInB1 = scheduler.getAppsInQueue("b1");
  assertTrue(appsInB1.isEmpty());
  List<ApplicationAttemptId> appsInB = scheduler.getAppsInQueue("b");
  assertTrue(appsInB.isEmpty());
  // now move the app
  try {
    scheduler.moveAllApps("DOES_NOT_EXIST", "b1");
    Assert.fail();
  } catch (YarnException e) {
    // expected
  }
  // check postconditions, app should still be in a1
  appsInA1 = scheduler.getAppsInQueue("a1");
  assertEquals(1, appsInA1.size());
  appsInA = scheduler.getAppsInQueue("a");
  assertTrue(appsInA.contains(appAttemptId));
  assertEquals(1, appsInA.size());
  appsInRoot = scheduler.getAppsInQueue("root");
  assertTrue(appsInRoot.contains(appAttemptId));
  assertEquals(1, appsInRoot.size());
  appsInB1 = scheduler.getAppsInQueue("b1");
  assertTrue(appsInB1.isEmpty());
  appsInB = scheduler.getAppsInQueue("b");
  assertTrue(appsInB.isEmpty());
  rm.stop();
}