Fix GitRootDetectorTest & GitRootErrorsFinderTest

This commit is contained in:
Kirill Likhodedov
2012-10-22 15:11:49 +04:00
parent 211d97d58b
commit 91774bf2c6
3 changed files with 20 additions and 4 deletions
@@ -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: [],