summaryrefslogtreecommitdiff
path: root/plugins/git4idea/tests/git4idea
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/git4idea/tests/git4idea')
-rw-r--r--plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java (renamed from plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java)15
-rw-r--r--plugins/git4idea/tests/git4idea/test/GitPlatformTest.java5
-rw-r--r--plugins/git4idea/tests/git4idea/test/GitTestUtil.java5
3 files changed, 16 insertions, 9 deletions
diff --git a/plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java
index 7346852bab68..707e97265267 100644
--- a/plugins/git4idea/tests/git4idea/log/GitLogRefSorterTest.java
+++ b/plugins/git4idea/tests/git4idea/log/GitRefManagerTest.java
@@ -21,10 +21,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
-/**
- * @author Kirill Likhodedov
- */
-public class GitLogRefSorterTest extends UsefulTestCase {
+public class GitRefManagerTest extends UsefulTestCase {
public static final MockVirtualFile MOCK_VIRTUAL_FILE = new MockVirtualFile("mockFile");
@@ -77,10 +74,10 @@ public class GitLogRefSorterTest extends UsefulTestCase {
expect("HEAD", "master", "release", "origin/master", "origin/great_feature", "tag/v1"));
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
+ // may happen e.g. in multi-repo case
+ public void testTwoMasters() {
+ check(given("master", "master"),
+ expect("master", "master"));
}
private static Collection<VcsRef> given(String... refs) {
@@ -205,7 +202,7 @@ public class GitLogRefSorterTest extends UsefulTestCase {
return infos;
}
});
- return new GitRefManager(manager).sort(refs);
+ return ContainerUtil.sorted(refs, new GitRefManager(manager).getComparator());
}
// TODO either use the real GitRepository, or move upwards and make more generic implementation
diff --git a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
index ecef2b2cdcf5..ef3f963c9c7e 100644
--- a/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
+++ b/plugins/git4idea/tests/git4idea/test/GitPlatformTest.java
@@ -29,6 +29,7 @@ import com.intellij.testFramework.UsefulTestCase;
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
import com.intellij.testFramework.vcs.AbstractVcsTestCase;
+import com.intellij.util.ObjectUtils;
import git4idea.DialogManager;
import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
@@ -57,6 +58,7 @@ public abstract class GitPlatformTest extends UsefulTestCase {
@NotNull protected GitVcsSettings myGitSettings;
@NotNull protected GitPlatformFacade myPlatformFacade;
@NotNull protected Git myGit;
+ @NotNull protected GitVcs myVcs;
@NotNull protected TestDialogManager myDialogManager;
@NotNull protected TestVcsNotifier myVcsNotifier;
@@ -97,7 +99,10 @@ public abstract class GitPlatformTest extends UsefulTestCase {
myGitRepositoryManager = GitUtil.getRepositoryManager(myProject);
myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class);
myGit = ServiceManager.getService(myProject, Git.class);
+ myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(myProject));
+ myVcs.doActivate();
+ GitTestUtil.assumeSupportedGitVersion(myVcs);
initChangeListManager();
addSilently();
removeSilently();
diff --git a/plugins/git4idea/tests/git4idea/test/GitTestUtil.java b/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
index a6a8f0cd79f5..842b1b1a2bae 100644
--- a/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
+++ b/plugins/git4idea/tests/git4idea/test/GitTestUtil.java
@@ -31,6 +31,7 @@ import java.io.File;
import static com.intellij.openapi.vcs.Executor.*;
import static git4idea.test.GitExecutor.git;
import static junit.framework.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
public class GitTestUtil {
@@ -108,4 +109,8 @@ public class GitTestUtil {
public static void setDefaultBuiltInServerPort() {
System.setProperty(BuiltInServerManagerImpl.PROPERTY_RPC_PORT, "64463");
}
+
+ public static void assumeSupportedGitVersion(@NotNull GitVcs vcs) {
+ assumeTrue(vcs.getVersion().isSupported());
+ }
}