mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix GitRootDetectorTest & GitRootErrorsFinderTest
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package git4idea.roots
|
||||
|
||||
import com.intellij.dvcs.test.MockProject
|
||||
import com.intellij.dvcs.test.MockProjectRootManager
|
||||
import com.intellij.dvcs.test.MockVirtualFile
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
@@ -53,12 +54,14 @@ class AbstractGitRootTest {
|
||||
createProjectStructure(project, projectStructure);
|
||||
createProjectStructure(project, contentRoots);
|
||||
|
||||
contentRoots.each { myPlatformFacade.myProjectRootManager.myContentRoots << MockVirtualFile.fromPath(it, project)}
|
||||
contentRoots.each {
|
||||
((MockProjectRootManager)myPlatformFacade.getProjectRootManager(project)).myContentRoots << MockVirtualFile.fromPath(it, project)
|
||||
}
|
||||
|
||||
project
|
||||
}
|
||||
|
||||
void createProjectStructure(Project project, Collection<String> paths) {
|
||||
static void createProjectStructure(Project project, Collection<String> paths) {
|
||||
paths.each { String path ->
|
||||
File file = new File(project.baseDir.path + "/" + path)
|
||||
file.mkdir()
|
||||
|
||||
@@ -18,6 +18,7 @@ package git4idea.roots
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import git4idea.test.GitGTestUtil
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
@@ -33,6 +34,12 @@ class GitRootDetectorTest extends AbstractGitRootTest {
|
||||
|
||||
@Before
|
||||
void setUp() {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@After
|
||||
void tearDown() {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -194,7 +201,7 @@ class GitRootDetectorTest extends AbstractGitRootTest {
|
||||
assertRoots(expected.roots, actual.roots)
|
||||
}
|
||||
|
||||
String roots(Collection roots) {
|
||||
static String roots(Collection roots) {
|
||||
"\nRoots:${roots.collect {"\n * $it"}}\n"
|
||||
}
|
||||
|
||||
@@ -202,7 +209,7 @@ class GitRootDetectorTest extends AbstractGitRootTest {
|
||||
assertEquals(GitGTestUtil.toAbsolute(expectedRelativePaths, myProject).toSet(), getPaths(actual).toSet())
|
||||
}
|
||||
|
||||
Collection<String> getPaths(Collection<VirtualFile> files) {
|
||||
static Collection<String> getPaths(Collection<VirtualFile> files) {
|
||||
files.collect { it.path }
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vcs.VcsDirectoryMapping
|
||||
import com.intellij.openapi.vcs.VcsRootError
|
||||
import git4idea.test.GitMockVcsManager
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
@@ -40,6 +41,11 @@ class GitRootErrorsFinderTest extends AbstractGitRootTest {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
@After
|
||||
void tearDown() {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@Test
|
||||
void "No roots, then no errors"() {
|
||||
doTest git: [],
|
||||
|
||||
Reference in New Issue
Block a user