void () { initRepository("foo"); String defaultBranchName = getDefaultBranchName(); LocalTaskImpl task = myTaskManager.createLocalTask("foo"); ApplicationManager.getApplication().invokeAndWait(() -> { OpenTaskDialog dialog = new OpenTaskDialog(getProject(), task); Disposer.register(getTestRootDisposable(), dialog.getDisposable()); try { dialog.createTask(); assertEquals("foo", myTaskManager.getActiveTask().getSummary()); List<BranchInfo> branches = task.getBranches(true); assertEquals(1, branches.size()); assertEquals(defaultBranchName, branches.get(0).name); branches = task.getBranches(false); assertEquals(1, branches.size()); assertEquals("foo", branches.get(0).name); } finally { dialog.close(DialogWrapper.OK_EXIT_CODE); } UIUtil.dispatchAllInvocationEvents(); }); }