void () { final LocalTaskImpl task = new LocalTaskImpl("foo", "bar"); runOpenTaskDialog(task); myChangeListManager.ensureUpToDate(); UIUtil.dispatchAllInvocationEvents(); // event from TaskManagerImpl.myChangeListListener runOpenTaskDialog(new LocalTaskImpl("next", "")); myChangeListManager.ensureUpToDate(); UIUtil.dispatchAllInvocationEvents(); // event from TaskManagerImpl.myChangeListListener final String changelistName = myTaskManager.getChangelistName(task); myChangeListManager.removeChangeList(changelistName); myChangeListManager.waitUntilRefreshed(); assertTrue(myTaskManager.isLocallyClosed(task)); myTaskManager.activateTask(task, false); assertNotNull(myChangeListManager.findChangeList(changelistName)); }