mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tests fix, jmockit was removed
This commit is contained in:
Generated
-2
@@ -12,7 +12,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-junit4-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-legacy-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmockit.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
@@ -21,7 +20,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-junit4-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-legacy-2.5.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmockit.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
+4
@@ -23,15 +23,19 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiCompiledElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.model.MavenId;
|
||||
import org.jetbrains.plugins.gradle.util.GradleBundle;
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 10/23/13
|
||||
*/
|
||||
public class AddGradleDslDependencyAction extends CodeInsightAction {
|
||||
static final ThreadLocal<List<MavenId>> TEST_THREAD_LOCAL = new ThreadLocal<List<MavenId>>();
|
||||
|
||||
public AddGradleDslDependencyAction() {
|
||||
getTemplatePresentation().setDescription(GradleBundle.message("gradle.codeInsight.action.add_maven_dependency.description"));
|
||||
|
||||
+9
-1
@@ -17,6 +17,7 @@ package org.jetbrains.plugins.gradle.integrations.maven.codeInsight.actions;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightActionHandler;
|
||||
import com.intellij.codeInsight.CodeInsightUtilBase;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -50,7 +51,14 @@ class AddGradleDslDependencyActionHandler implements CodeInsightActionHandler {
|
||||
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
|
||||
if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
|
||||
|
||||
final List<MavenId> ids = MavenArtifactSearchDialog.searchForArtifact(project, ContainerUtil.<MavenDomDependency>emptyList());
|
||||
final List<MavenId> ids;
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
ids = AddGradleDslDependencyAction.TEST_THREAD_LOCAL.get();
|
||||
}
|
||||
else {
|
||||
ids = MavenArtifactSearchDialog.searchForArtifact(project, ContainerUtil.<MavenDomDependency>emptyList());
|
||||
}
|
||||
|
||||
if (ids.isEmpty()) return;
|
||||
|
||||
new WriteCommandAction.Simple(project, GradleBundle.message("gradle.codeInsight.action.add_maven_dependency.text"), file) {
|
||||
|
||||
+2
-20
@@ -20,10 +20,6 @@ import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import mockit.Mocked;
|
||||
import mockit.NonStrictExpectations;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
|
||||
import org.jetbrains.idea.maven.indices.MavenArtifactSearchDialog;
|
||||
import org.jetbrains.idea.maven.model.MavenId;
|
||||
|
||||
import java.io.File;
|
||||
@@ -34,31 +30,17 @@ import java.io.File;
|
||||
*/
|
||||
public class AddGradleDslDependencyActionTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
@Mocked(stubOutClassInitialization = true) final MavenArtifactSearchDialog unused = null;
|
||||
|
||||
public AddGradleDslDependencyActionTest() {
|
||||
IdeaTestCase.initPlatformPrefix();
|
||||
}
|
||||
|
||||
public void testAddMavenDependencyInEmptyFile() throws Exception {
|
||||
new NonStrictExpectations() {
|
||||
{
|
||||
MavenArtifactSearchDialog.searchForArtifact(getProject(), ContainerUtil.<MavenDomDependency>emptyList());
|
||||
result = ContainerUtil.list(new MavenId("testGroupId", "testArtifactId", "1.0"));
|
||||
}
|
||||
};
|
||||
|
||||
AddGradleDslDependencyAction.TEST_THREAD_LOCAL.set(ContainerUtil.list(new MavenId("testGroupId", "testArtifactId", "1.0")));
|
||||
doTest("testAddMavenDependencyInEmptyFile.gradle");
|
||||
}
|
||||
|
||||
public void testAddMavenDependencyIntoExistingBlock() throws Exception {
|
||||
new NonStrictExpectations() {
|
||||
{
|
||||
MavenArtifactSearchDialog.searchForArtifact(getProject(), ContainerUtil.<MavenDomDependency>emptyList());
|
||||
result = ContainerUtil.list(new MavenId("testGroupId", "testArtifactId", "1.0"));
|
||||
}
|
||||
};
|
||||
|
||||
AddGradleDslDependencyAction.TEST_THREAD_LOCAL.set(ContainerUtil.list(new MavenId("testGroupId", "testArtifactId", "1.0")));
|
||||
doTest("testAddMavenDependencyIntoExistingBlock.gradle");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user