[devkit] cleanup tests

This commit is contained in:
Yann Cébron
2016-11-09 12:02:42 +01:00
parent 20ed942a28
commit f671f9f11e
6 changed files with 31 additions and 27 deletions
@@ -46,7 +46,7 @@ import java.util.Arrays;
import java.util.List;
@RunWith(Parameterized.class)
public class CreateClassFixTest extends UsefulTestCase{
public class CreateClassFixTest extends UsefulTestCase {
protected CodeInsightTestFixture myFixture;
@org.junit.runners.Parameterized.Parameter(0) public String myTestName;
@@ -54,13 +54,15 @@ public class CreateClassFixTest extends UsefulTestCase{
@Before
public void setUp() throws Exception {
super.setUp();
final Ref<Exception> ex = new Ref<>();
Runnable runnable = new Runnable() {
public void run() {
try {
CreateClassFixTest.super.setUp();
final JavaTestFixtureFactory fixtureFactory = JavaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = JavaTestFixtureFactory.createFixtureBuilder(getClass().getSimpleName());
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder =
JavaTestFixtureFactory.createFixtureBuilder(getClass().getSimpleName());
myFixture = fixtureFactory.createCodeInsightFixture(testFixtureBuilder.getFixture());
myFixture.setTestDataPath(PluginPathManager.getPluginHomePath("devkit") + "/testData");
@@ -81,6 +83,7 @@ public class CreateClassFixTest extends UsefulTestCase{
}
}
@SuppressWarnings("MethodDoesntCallSuperMethod")
@After
public void tearDown() throws Exception {
final Ref<Exception> ex = new Ref<>();
@@ -106,9 +109,9 @@ public class CreateClassFixTest extends UsefulTestCase{
@Parameterized.Parameters(name = "{0} : {1}")
public static List<Object[]> data() {
return Arrays.asList(new Object[]{"Action", true},
new Object[]{"Impl", true},
new Object[]{"Intf", true},
return Arrays.asList(new Object[]{"Action", true},
new Object[]{"Impl", true},
new Object[]{"Intf", true},
new Object[]{"Intf", false});
}
@@ -60,7 +60,7 @@ public class PluginXmlDomStubsTest extends DomStubTest {
" Attribute:text:nestedGroupActionText\n");
}
public void testXInclude() throws Exception {
public void testXInclude() {
prepareFile("pluginWithXInclude-extensionPoints.xml");
prepareFile("pluginWithXInclude-main.xml");
prepareFile("pluginWithXInclude.xml");
@@ -67,7 +67,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
moduleBuilder.addLibrary("platform-impl", platformImplJar)
}
void testExtensionsHighlighting() throws Throwable {
void testExtensionsHighlighting() {
final String root = "idea_core"
addPluginXml(root, """
<id>com.intellij</id>
@@ -96,7 +96,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.checkHighlighting(true, false, false)
}
void testDependsHighlighting() throws Throwable {
void testDependsHighlighting() {
final String root = "idea_core"
addPluginXml(root, """
<id>com.intellij</id>
@@ -119,7 +119,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
assertSameElements(myFixture.getLookupElementStrings(), "optional.xml", "optional2.xml")
}
void testDependsCompletion() throws Throwable {
void testDependsCompletion() {
addPluginXml("platform", """
<id>com.intellij</id>
<module value="com.intellij.modules.vcs"/>
@@ -143,13 +143,13 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.configureFromExistingVirtualFile(myFixture.copyFileToProject(getTestName(false) + ".xml", "META-INF/plugin.xml"))
}
void testExtensionQualifiedName() throws Throwable {
void testExtensionQualifiedName() {
myFixture.addClass("package foo; public class MyRunnable implements java.lang.Runnable {}")
configureByFile()
myFixture.checkHighlighting(false, false, false)
}
void testInnerClassCompletion() throws Throwable {
void testInnerClassCompletion() {
myFixture.addClass("package foo; public class Foo { public static class Fubar {} }")
myFixture.configureByFile(getTestName(false) + ".xml")
myFixture.completeBasic()
@@ -157,14 +157,14 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.checkResultByFile(getTestName(false) + "_after.xml")
}
void testInnerClassSmartCompletion() throws Throwable {
void testInnerClassSmartCompletion() {
myFixture.addClass("package foo; public class Foo { public static class Fubar extends Foo {} }")
myFixture.configureByFile(getTestName(false) + ".xml")
myFixture.complete(CompletionType.SMART)
myFixture.checkResultByFile(getTestName(false) + "_after.xml")
}
void testResolveExtensionsFromDependentDescriptor() throws Throwable {
void testResolveExtensionsFromDependentDescriptor() {
addPluginXml("xxx", """
<id>com.intellij.xxx</id>
<extensionPoints>
@@ -184,7 +184,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
ApplicationManager.application.runWriteAction { PsiTestUtil.addSourceContentToRoots(myModule, myTempDirFixture.getFile(root)) }
}
void testNoWordCompletionInClassPlaces() throws Throwable {
void testNoWordCompletionInClassPlaces() {
myFixture.addClass("package foo; public class FooFooFooFooFoo { }")
myFixture.addClass("package foo; public interface ExtIntf { }")
@@ -194,7 +194,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.checkResultByFile(getTestName(false) + "_after.xml")
}
void testNoClassCompletionOutsideJavaReferences() throws Throwable {
void testNoClassCompletionOutsideJavaReferences() {
myFixture.addClass("package foo; public class FooFooFooFooFoo { }")
myFixture.configureByFile(getTestName(false) + ".xml")
@@ -287,7 +287,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
"MyIconAttributeEPBean.java")
}
void testPluginWithModules() throws Throwable {
void testPluginWithModules() {
myFixture.testHighlighting("pluginWithModules.xml")
}
@@ -322,7 +322,7 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
myFixture.checkResultByFile("pluginWithBigNumberInUntilBuild_after.xml")
}
void testPluginWithXInclude() throws Throwable {
void testPluginWithXInclude() {
myFixture.testHighlighting("pluginWithXInclude.xml", "pluginWithXInclude-extensionPoints.xml")
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import com.intellij.ui.components.JBList;
import com.intellij.util.PathUtil;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@TestDataPath("$CONTENT_ROOT/testData/navigation/descriptionType")
@@ -63,7 +64,7 @@ public class DescriptionTypeRelatedItemLineMarkerProviderTest extends JavaCodeIn
List<GutterMark> gutters = myFixture.findAllGutters("MyIntentionActionWithDescription.java");
assertSize(2, gutters);
Collections.sort(gutters, (g1, g2) -> g1.getTooltipText().compareTo(g2.getTooltipText()));
Collections.sort(gutters, Comparator.comparing(GutterMark::getTooltipText));
DevKitGutterTargetsChecker.checkGutterTargets(gutters.get(1), "Description", AllIcons.FileTypes.Html, "description.html");
DevKitGutterTargetsChecker.checkGutterTargets(gutters.get(0), "Before/After Templates", AllIcons.Actions.Diff,
"after.java.template", "before.java.template");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,15 +28,15 @@ public class TestDataPathCompletionTest extends TestDataPathTestCase {
doTest();
}
public void testReferencesAfterProjectRoot() throws Exception {
public void testReferencesAfterProjectRoot() {
doTest();
}
public void testContentRoot() throws Exception {
public void testContentRoot() {
doTest();
}
public void testReferencesAfterContentRoot() throws Exception {
public void testReferencesAfterContentRoot() {
doTest();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,15 +32,15 @@ public class TestDataPathResolvingTest extends TestDataPathTestCase {
doTest(PsiManager.getInstance(myFixture.getProject()).findDirectory(myFixture.getProject().getBaseDir()));
}
public void testReferencesAfterProjectRoot() throws Exception {
public void testReferencesAfterProjectRoot() {
doTest(PsiManager.getInstance(myFixture.getProject()).findDirectory(myProjectSubdir));
}
public void testContentRootReference() throws Exception {
public void testContentRootReference() {
doTest(PsiManager.getInstance(myFixture.getProject()).findDirectory(myContentRoot));
}
public void testReferencesAfterContentRoot() throws Exception {
public void testReferencesAfterContentRoot() {
doTest(PsiManager.getInstance(myFixture.getProject()).findDirectory(myContentRootSubdir));
}