Skip to content

Commit fc860a6

Browse files
amaembointellij-monorepo-bot
authored andcommitted
IDEA-384631 [java-typeMigration] Make GuavaInspectionTest light-test and remove guava-stubs.jar
GitOrigin-RevId: 427fb809fe90b6389d399c572e27010b40872728
1 parent b25b05e commit fc860a6

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

java/typeMigration/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jvm_library(
5555
"//platform/code-style-impl:codeStyle-impl",
5656
"//java/java-impl-refactorings:impl-refactorings",
5757
"//java/codeserver/highlighting",
58+
"//platform/projectModel-api:projectModel",
5859
]
5960
)
6061
### auto-generated section `build intellij.java.typeMigration` end

java/typeMigration/intellij.java.typeMigration.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
<orderEntry type="module" module-name="intellij.platform.codeStyle.impl" scope="TEST" />
2727
<orderEntry type="module" module-name="intellij.java.impl.refactorings" />
2828
<orderEntry type="module" module-name="intellij.java.codeserver.highlighting" />
29+
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="TEST" />
2930
</component>
3031
</module>

java/typeMigration/test/com/intellij/codeInsight/inspections/GuavaInspectionTest.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@
44
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
55
import com.intellij.codeInsight.intention.IntentionAction;
66
import com.intellij.codeInspection.actions.CleanupInspectionIntention;
7-
import com.intellij.pom.java.LanguageLevel;
87
import com.intellij.psi.PsiElement;
98
import com.intellij.psi.PsiMethodCallExpression;
109
import com.intellij.psi.util.PsiTreeUtil;
1110
import com.intellij.refactoring.typeMigration.TypeMigrationBundle;
1211
import com.intellij.refactoring.typeMigration.inspections.GuavaInspection;
1312
import com.intellij.testFramework.IdeaTestUtil;
13+
import com.intellij.testFramework.LightProjectDescriptor;
1414
import com.intellij.testFramework.PlatformTestUtil;
15-
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
16-
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
15+
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
16+
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
1717
import org.jetbrains.annotations.NotNull;
1818

1919
import java.util.Arrays;
20+
import java.util.List;
2021

2122
/**
2223
* @author Dmitry Batkovich
2324
*/
24-
public class GuavaInspectionTest extends JavaCodeInsightFixtureTestCase {
25+
public class GuavaInspectionTest extends LightJavaCodeInsightFixtureTestCase {
26+
private static final LightProjectDescriptor DESCRIPTOR =
27+
new DefaultLightProjectDescriptor(IdeaTestUtil::getMockJdk18, List.of("com.google.guava:guava:20.0"));
28+
2529
private GuavaInspection myInspection;
2630

2731
@Override
@@ -32,15 +36,13 @@ public void setUp() throws Exception {
3236
}
3337

3438
@Override
35-
protected String getTestDataPath() {
36-
return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData/inspections/guava";
39+
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
40+
return DESCRIPTOR;
3741
}
3842

3943
@Override
40-
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) {
41-
moduleBuilder.setLanguageLevel(LanguageLevel.JDK_1_8);
42-
moduleBuilder.addLibraryJars("guava", getTestDataPath() + "/", "guava-stubs.jar");
43-
moduleBuilder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
44+
protected String getTestDataPath() {
45+
return PlatformTestUtil.getCommunityPath() + "/java/typeMigration/testData/inspections/guava";
4446
}
4547

4648
public void testOptional() {
-1.01 MB
Binary file not shown.

0 commit comments

Comments
 (0)