public void testRestoreChangelist() throws Exception {
    final LocalTaskImpl task = new LocalTaskImpl("foo", "bar");
    activateAndCreateChangelist(task);
    activateAndCreateChangelist(new LocalTaskImpl("next", ""));

    final String changelistName = myTaskManager.getChangelistName(task);
    myChangeListManager.removeChangeList(changelistName);

    myChangeListManager.invokeAfterUpdate(
        () -> {
          assertTrue(myTaskManager.isLocallyClosed(task));
          activateAndCreateChangelist(task);
          assertNotNull(myChangeListManager.findChangeList(changelistName));
        },
        InvokeAfterUpdateMode.SYNCHRONOUS_NOT_CANCELLABLE,
        "foo",
        ModalityState.NON_MODAL);
  }
 private void removeChangeList(LocalChangeList changeList) {
   myChangeListManager.removeChangeList(changeList);
   myTaskManager.getChangeListListener().changeListRemoved(changeList);
 }