void () { List<Repository> repositories = initRepositories("community", "idea"); LocalTask defaultTask = myTaskManager.getActiveTask(); assertNotNull(defaultTask); LocalTaskImpl foo = myTaskManager.createLocalTask("foo"); LocalTask localTask = myTaskManager.activateTask(foo, false); myTaskManager.createBranch(localTask, defaultTask, myTaskManager.suggestBranchName(localTask), null); String defaultBranchName = getDefaultBranchName(); assertEquals(4, localTask.getBranches().size()); assertEquals(2, localTask.getBranches(true).size()); assertEquals(2, localTask.getBranches(false).size()); assertEquals(2, defaultTask.getBranches().size()); ApplicationManager.getApplication().invokeAndWait(() -> myTaskManager.activateTask(defaultTask, false)); Repository repository = repositories.get(0); assertEquals(defaultBranchName, repository.getCurrentBranchName()); LocalTaskImpl foo2 = myTaskManager.createLocalTask("foo"); LocalTask localTask2 = myTaskManager.activateTask(foo2, false); ApplicationManager.getApplication() .invokeAndWait(() -> myTaskManager.createBranch(localTask2, defaultTask, myTaskManager.suggestBranchName(localTask2), null)); assertEquals("foo", repository.getCurrentBranchName()); createAndCommitChanges(repository); ApplicationManager.getApplication().invokeAndWait(() -> myTaskManager.mergeBranch(localTask2)); repository.update(); assertEquals(defaultBranchName, repository.getCurrentBranchName()); assertEquals(1, getNumberOfBranches(repository)); ApplicationManager.getApplication().invokeAndWait(() -> myTaskManager.activateTask(defaultTask, false)); ApplicationManager.getApplication().invokeAndWait(() -> myTaskManager.activateTask(foo2, false)); }