mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull in tests
This commit is contained in:
@@ -314,7 +314,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Module doCreateRealModule(String moduleName) {
|
||||
protected Module doCreateRealModule(@NotNull String moduleName) {
|
||||
//todo[nik] reuse code from PlatformTestCase
|
||||
final VirtualFile baseDir = getOrCreateProjectBaseDir();
|
||||
final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
|
||||
|
||||
@@ -418,7 +418,7 @@ public abstract class CompilerTestCase extends ModuleTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FacetLibrariesValidatorTest extends FacetTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Module createModule(final String moduleName) {
|
||||
protected Module createModule(@NotNull final String moduleName) {
|
||||
return createModule(moduleName, StdModuleTypes.JAVA);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ public abstract class FacetTestCase extends PsiTestCase {
|
||||
commit(model);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Module loadModule(@NotNull String relativePath) {
|
||||
return super.loadModule(PathManagerEx.getTestDataPath() + "/" + relativePath);
|
||||
|
||||
@@ -146,6 +146,7 @@ public class SaveProjectAsTemplateTest extends NewProjectWizardTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Project doCreateProject(@NotNull Path projectFile) throws Exception {
|
||||
FileUtil.ensureExists(projectFile.getParent().resolve(Project.DIRECTORY_STORE_FOLDER).toFile());
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class WordCompletionTest extends CompletionTestCase {
|
||||
private static final String BASE_PATH = "/codeInsight/completion/word/";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
+2
@@ -28,6 +28,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.lang.JavaVersion;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.intellij.lang.annotations.Flow;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -42,6 +43,7 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
|
||||
|
||||
private int myJdkVersion = 7;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.testFramework.InspectionsKt;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -108,6 +109,7 @@ public class GlobalInspectionContextTest extends CodeInsightTestCase {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/inspection/globalContext/";
|
||||
|
||||
+1
@@ -59,6 +59,7 @@ public class CompilerReferencesFindUsagesTest extends DaemonAnalyzerTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/compiler/compilerReferenceFindUsages/";
|
||||
|
||||
@@ -29,11 +29,13 @@ import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.TestActionEvent;
|
||||
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaCallHierarchyTest extends HierarchyViewTestBase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
@@ -25,11 +25,13 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@PlatformTestCase.WrapInCommand
|
||||
public class NormalizeDeclarationTest extends PsiTestCase{
|
||||
private static final String BASE_PATH = JavaTestUtil.getJavaTestDataPath() + "/psi/normalizeDeclaration";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return BASE_PATH;
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.util.Comparator;
|
||||
|
||||
public class MovePackageAsDirectoryTest extends MultiFileTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class MovePackageMultirootTest extends MultiFileTestCase {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
|
||||
|
||||
public class SafeDeleteTest extends MultiFileTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath();
|
||||
|
||||
@@ -35,10 +35,10 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
}
|
||||
}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("loaded"), root.findChild("loaded"))
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded-inner"), root.findFileByRelativePath("loaded/unloaded-inner"))
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded"), root.findChild("unloaded"))
|
||||
PsiTestUtil.addContentRoot(createModule("loaded-inner"), root.findFileByRelativePath("unloaded/loaded-inner"))
|
||||
PsiTestUtil.addContentRoot(createModule("loaded"), root.findChild("loaded")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded-inner"), root.findFileByRelativePath("loaded/unloaded-inner")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded"), root.findChild("unloaded")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("loaded-inner"), root.findFileByRelativePath("unloaded/loaded-inner")!!)
|
||||
val expected = """
|
||||
|Project
|
||||
| loaded
|
||||
@@ -72,8 +72,8 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
dir("subdir") {}
|
||||
}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.unloaded"), root.findChild("unloaded"))
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded2"), root.findChild("unloaded2"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.unloaded"), root.findChild("unloaded")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("unloaded2"), root.findChild("unloaded2")!!)
|
||||
|
||||
val expected = """
|
||||
|Project
|
||||
@@ -100,7 +100,7 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
dir("subdir") {}
|
||||
}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module"), root.findChild("module"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module"), root.findChild("module")!!)
|
||||
assertStructureEqual("""
|
||||
|Project
|
||||
| foo.bar.module.iml
|
||||
@@ -116,8 +116,8 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
dir("module1") {}
|
||||
dir("module2") {}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module1"), root.findChild("module1"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module2"), root.findChild("module2"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module1"), root.findChild("module1")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module2"), root.findChild("module2")!!)
|
||||
myStructure.isFlattenModules = true
|
||||
assertStructureEqual("""
|
||||
|Project
|
||||
@@ -135,8 +135,8 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
dir("foo") {}
|
||||
dir("foo.bar") {}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("xxx.foo"), root.findChild("foo"))
|
||||
PsiTestUtil.addContentRoot(createModule("xxx.foo.bar"), root.findChild("foo.bar"))
|
||||
PsiTestUtil.addContentRoot(createModule("xxx.foo"), root.findChild("foo")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("xxx.foo.bar"), root.findChild("foo.bar")!!)
|
||||
assertStructureEqual("""
|
||||
|Project
|
||||
| Group: xxx
|
||||
@@ -158,8 +158,8 @@ class ModulesInProjectViewTest : BaseProjectViewTestCase() {
|
||||
dir("subdir") {}
|
||||
}
|
||||
}.generateInVirtualTempDir()
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module1"), root.findChild("module1"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.baz.module2"), root.findChild("module2"))
|
||||
PsiTestUtil.addContentRoot(createModule("foo.bar.module1"), root.findChild("module1")!!)
|
||||
PsiTestUtil.addContentRoot(createModule("foo.baz.module2"), root.findChild("module2")!!)
|
||||
assertStructureEqual("""
|
||||
|Project
|
||||
| Group: foo
|
||||
|
||||
@@ -131,7 +131,7 @@ public abstract class DebuggerTestCase extends ExecutionWithDebuggerToolsTestCas
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
myTestRootDisposable = new TestDisposable();
|
||||
super.runBareRunnable(runnable);
|
||||
while (needsRestart()) {
|
||||
|
||||
@@ -105,7 +105,7 @@ public abstract class ExecutionTestCase extends IdeaTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public abstract class IdeaTestCase extends PlatformTestCase {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final JavaPsiFacadeEx getJavaFacade() {
|
||||
return myJavaFacade;
|
||||
}
|
||||
@@ -42,6 +43,7 @@ public abstract class IdeaTestCase extends PlatformTestCase {
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected ModuleType getModuleType() {
|
||||
return StdModuleTypes.JAVA;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.lang.JavaVersion;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
@@ -39,7 +40,7 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
System.out.println(Timings.getStatistics());
|
||||
}
|
||||
|
||||
public static void withLevel(final Module module, final LanguageLevel level, final Runnable r) {
|
||||
public static void withLevel(@NotNull final Module module, @NotNull LanguageLevel level, @NotNull final Runnable r) {
|
||||
final LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(module.getProject());
|
||||
|
||||
final LanguageLevel projectLevel = projectExt.getLanguageLevel();
|
||||
@@ -55,67 +56,77 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setModuleLanguageLevel(Module module, final LanguageLevel level) {
|
||||
public static void setModuleLanguageLevel(@NotNull Module module, @Nullable LanguageLevel level) {
|
||||
final LanguageLevelModuleExtensionImpl
|
||||
modifiable = (LanguageLevelModuleExtensionImpl)LanguageLevelModuleExtensionImpl.getInstance(module).getModifiableModel(true);
|
||||
modifiable.setLanguageLevel(level);
|
||||
modifiable.commit();
|
||||
}
|
||||
|
||||
public static void setModuleLanguageLevel(Module module, final LanguageLevel level, Disposable parentDisposable) {
|
||||
public static void setModuleLanguageLevel(@NotNull Module module, @NotNull LanguageLevel level, @NotNull Disposable parentDisposable) {
|
||||
LanguageLevel prev = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
|
||||
setModuleLanguageLevel(module, level);
|
||||
Disposer.register(parentDisposable, () -> setModuleLanguageLevel(module, prev));
|
||||
}
|
||||
|
||||
public static Sdk getMockJdk(JavaVersion version) {
|
||||
@NotNull
|
||||
public static Sdk getMockJdk(@NotNull JavaVersion version) {
|
||||
int mockJdk = version.feature >= 9 ? 9 : version.feature >= 7 ? version.feature : version.feature >= 5 ? 7 : 4;
|
||||
String path = getPathForJdkNamed(MOCK_JDK_DIR_NAME_PREFIX + "1." + mockJdk).getPath();
|
||||
return createMockJdk("java " + version, path);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Sdk createMockJdk(@NotNull String name, String path) {
|
||||
private static Sdk createMockJdk(@NotNull String name, @NotNull String path) {
|
||||
return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getMockJdk14() {
|
||||
return getMockJdk(JavaVersion.compose(4));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getMockJdk17() {
|
||||
return getMockJdk(JavaVersion.compose(7));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getMockJdk17(@NotNull String name) {
|
||||
return createMockJdk(name, getMockJdk17Path().getPath());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getMockJdk18() {
|
||||
return getMockJdk(JavaVersion.compose(8));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getMockJdk9() {
|
||||
return getMockJdk(JavaVersion.compose(9));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getMockJdk14Path() {
|
||||
return getPathForJdkNamed(MOCK_JDK_DIR_NAME_PREFIX + "1.4");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getMockJdk17Path() {
|
||||
return getPathForJdkNamed(MOCK_JDK_DIR_NAME_PREFIX + "1.7");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getMockJdk18Path() {
|
||||
return getPathForJdkNamed(MOCK_JDK_DIR_NAME_PREFIX + "1.8");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File getMockJdk9Path() {
|
||||
return getPathForJdkNamed(MOCK_JDK_DIR_NAME_PREFIX + "1.9");
|
||||
}
|
||||
|
||||
public static String getMockJdkVersion(String path) {
|
||||
public static String getMockJdkVersion(@NotNull String path) {
|
||||
String name = PathUtil.getFileName(path);
|
||||
if (name.startsWith(MOCK_JDK_DIR_NAME_PREFIX)) {
|
||||
return "java " + StringUtil.trimStart(name, MOCK_JDK_DIR_NAME_PREFIX);
|
||||
@@ -123,10 +134,12 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static File getPathForJdkNamed(String name) {
|
||||
@NotNull
|
||||
private static File getPathForJdkNamed(@NotNull String name) {
|
||||
return new File(PathManager.getCommunityHomePath(), "java/" + name);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Sdk getWebMockJdk17() {
|
||||
Sdk jdk = getMockJdk17();
|
||||
jdk=addWebJarsTo(jdk);
|
||||
@@ -149,7 +162,8 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
return jdk;
|
||||
}
|
||||
|
||||
private static VirtualFile findJar(String name) {
|
||||
@NotNull
|
||||
private static VirtualFile findJar(@NotNull String name) {
|
||||
String path = PathManager.getHomePath() + '/' + name;
|
||||
VirtualFile file = VfsTestUtil.findFileByCaseSensitivePath(path);
|
||||
VirtualFile jar = JarFileSystem.getInstance().getJarRootForLocalFile(file);
|
||||
@@ -184,6 +198,7 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File findSourceFile(@NotNull String basePath) {
|
||||
File testFile = new File(basePath + ".java");
|
||||
if (!testFile.exists()) testFile = new File(basePath + ".groovy");
|
||||
@@ -192,7 +207,7 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnnecessaryFullyQualifiedName")
|
||||
public static void compileFile(@NotNull File source, @NotNull File out, String... options) {
|
||||
public static void compileFile(@NotNull File source, @NotNull File out, @NotNull String... options) {
|
||||
Assert.assertTrue("source does not exist: " + source.getPath(), source.isFile());
|
||||
|
||||
List<String> args = new ArrayList<>();
|
||||
|
||||
@@ -82,26 +82,31 @@ public abstract class ModuleTestCase extends IdeaTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module createModule(@NotNull File moduleFile) {
|
||||
return createModule(moduleFile, StdModuleTypes.JAVA);
|
||||
}
|
||||
|
||||
protected Module createModule(final File moduleFile, final ModuleType moduleType) {
|
||||
@NotNull
|
||||
protected Module createModule(@NotNull final File moduleFile, @NotNull ModuleType moduleType) {
|
||||
final String path = moduleFile.getAbsolutePath();
|
||||
return createModule(path, moduleType);
|
||||
}
|
||||
|
||||
protected Module createModule(final String path, final ModuleType moduleType) {
|
||||
@NotNull
|
||||
protected Module createModule(@NotNull String path, @NotNull ModuleType moduleType) {
|
||||
Module module = WriteAction.compute(() -> ModuleManager.getInstance(myProject).newModule(path, moduleType.getId()));
|
||||
|
||||
myModulesToDispose.add(module);
|
||||
return module;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module loadModule(@NotNull VirtualFile file) {
|
||||
return loadModule(file.getPath());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module loadModule(@NotNull String modulePath) {
|
||||
final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
|
||||
Module module;
|
||||
@@ -110,8 +115,7 @@ public abstract class ModuleTestCase extends IdeaTestCase {
|
||||
FileUtil.toSystemIndependentName(modulePath)));
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
myModulesToDispose.add(module);
|
||||
@@ -144,7 +148,8 @@ public abstract class ModuleTestCase extends IdeaTestCase {
|
||||
return result.get();
|
||||
}
|
||||
|
||||
protected Module createModuleFromTestData(final String dirInTestData, final String newModuleFileName, final ModuleType moduleType,
|
||||
@NotNull
|
||||
protected Module createModuleFromTestData(@NotNull String dirInTestData, @NotNull String newModuleFileName, @NotNull ModuleType moduleType,
|
||||
final boolean addSourceRoot)
|
||||
throws IOException {
|
||||
final File dirInTestDataFile = new File(dirInTestData);
|
||||
|
||||
@@ -106,11 +106,11 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
protected void addSourceContentToRoots(final Module module, final VirtualFile vDir) {
|
||||
protected void addSourceContentToRoots(@NotNull Module module, @NotNull VirtualFile vDir) {
|
||||
PsiTestUtil.addSourceContentToRoots(module, vDir);
|
||||
}
|
||||
|
||||
protected PsiElement configureByFileWithMarker(String filePath, String marker) throws Exception{
|
||||
protected PsiElement configureByFileWithMarker(@NotNull String filePath, @NotNull String marker) throws Exception{
|
||||
final VirtualFile vFile = VfsTestUtil.findFileByCaseSensitivePath(filePath);
|
||||
|
||||
String fileText = VfsUtilCore.loadText(vFile);
|
||||
@@ -137,15 +137,18 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
myFile = myPsiManager.findFile(vFile);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getTestDataPath() {
|
||||
return PathManagerEx.getTestDataPath();
|
||||
}
|
||||
|
||||
protected String loadFile(String name) throws Exception {
|
||||
@NotNull
|
||||
protected String loadFile(@NotNull String name) throws Exception {
|
||||
String result = FileUtil.loadFile(new File(getTestDataPath() + File.separatorChar + name));
|
||||
return StringUtil.convertLineSeparators(result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PsiTestData loadData(String dataName) throws Exception {
|
||||
PsiTestData data = createData();
|
||||
Element documentElement = JdomKt.loadElement(Paths.get(myDataRoot, "data.xml"));
|
||||
@@ -162,6 +165,7 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
throw new IllegalArgumentException("Cannot find data chunk '" + dataName + "'");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiTestData createData() {
|
||||
return new PsiTestData();
|
||||
}
|
||||
@@ -185,7 +189,7 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
// assertEquals(myTestDataAfter.getText(), myFile.getText());
|
||||
}
|
||||
|
||||
protected static void printText(String text) {
|
||||
protected static void printText(@NotNull String text) {
|
||||
final String q = "\"";
|
||||
System.out.print(q);
|
||||
|
||||
@@ -209,11 +213,11 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
protected void addLibraryToRoots(final VirtualFile jarFile, OrderRootType rootType) {
|
||||
protected void addLibraryToRoots(@NotNull VirtualFile jarFile, @NotNull OrderRootType rootType) {
|
||||
addLibraryToRoots(myModule, jarFile, rootType);
|
||||
}
|
||||
|
||||
protected static void addLibraryToRoots(final Module module, final VirtualFile root, final OrderRootType rootType) {
|
||||
protected static void addLibraryToRoots(@NotNull Module module, @NotNull VirtualFile root, @NotNull OrderRootType rootType) {
|
||||
assertEquals(OrderRootType.CLASSES, rootType);
|
||||
ModuleRootModificationUtil.addModuleLibrary(module, root.getUrl());
|
||||
}
|
||||
@@ -223,15 +227,15 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
public Document getDocument(PsiFile file) {
|
||||
public Document getDocument(@NotNull PsiFile file) {
|
||||
return PsiDocumentManager.getInstance(getProject()).getDocument(file);
|
||||
}
|
||||
|
||||
public Document getDocument(VirtualFile file) {
|
||||
public Document getDocument(@NotNull VirtualFile file) {
|
||||
return FileDocumentManager.getInstance().getDocument(file);
|
||||
}
|
||||
|
||||
public void commitDocument(Document document) {
|
||||
public void commitDocument(@NotNull Document document) {
|
||||
PsiDocumentManager.getInstance(getProject()).commitDocument(document);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public abstract class ResolveTestCase extends PsiTestCase {
|
||||
return ref;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PathManagerEx.getTestDataPath() + "/psi/resolve/";
|
||||
|
||||
@@ -44,6 +44,7 @@ public abstract class JsonSchemaHeavyAbstractTest extends CompletionTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestDataPath() {
|
||||
PathManagerEx.TestDataLookupStrategy strategy = PathManagerEx.guessTestDataLookupStrategy();
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.containers.Predicate;
|
||||
import com.jetbrains.jsonSchema.impl.inspections.JsonSchemaComplianceInspection;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -20,6 +21,7 @@ import java.util.List;
|
||||
* @author Irina.Chernushina on 9/21/2015.
|
||||
*/
|
||||
public class JsonSchemaHighlightingTest extends JsonSchemaHighlightingTestBase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath() + "/json/tests/testData/jsonSchema/highlighting";
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
public class JsonSchemaReSharperHighlightingTest extends JsonSchemaHighlightingTestBase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath() + "/json/tests/testData/jsonSchema/highlighting/resharper";
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider;
|
||||
import com.jetbrains.jsonSchema.extension.JsonSchemaProjectSelfProviderFactory;
|
||||
import com.jetbrains.jsonSchema.ide.JsonSchemaService;
|
||||
import com.jetbrains.jsonSchema.impl.inspections.JsonSchemaComplianceInspection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
@@ -29,6 +30,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* @author Irina.Chernushina on 8/29/2015.
|
||||
*/
|
||||
public class JsonSchemaReadTest extends CompletionTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath() + "/json/tests/testData/jsonSchema";
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class ExternalChangesAndRefreshingTest extends IntegrationTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> r) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> r) throws Throwable {
|
||||
if (getName().equals("testRefreshingAsynchronously")) {
|
||||
// this method waits for another thread to finish, that leads
|
||||
// to deadlock in swing-thread. Therefore we have to run this test
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class LaterInvocatorTest extends PlatformTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
runnable.run();
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +123,12 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
return myTempFiles;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final VirtualFile createTestProjectStructure() throws IOException {
|
||||
return PsiTestUtil.createTestProjectStructure(myProject, myModule, myFilesToDelete);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final VirtualFile createTestProjectStructure(String rootPath) throws Exception {
|
||||
return PsiTestUtil.createTestProjectStructure(myProject, myModule, rootPath, myFilesToDelete);
|
||||
}
|
||||
@@ -232,6 +234,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final PsiManager getPsiManager() {
|
||||
return PsiManager.getInstance(myProject);
|
||||
}
|
||||
@@ -259,12 +262,13 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Project doCreateProject(@NotNull Path projectFile) throws Exception {
|
||||
return createProject(projectFile.toFile(), getClass().getName() + "." + getName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Project createProject(File projectFile, @NotNull String creationPlace) {
|
||||
public static Project createProject(@NotNull File projectFile, @NotNull String creationPlace) {
|
||||
return createProject(projectFile.getPath(), creationPlace);
|
||||
}
|
||||
|
||||
@@ -290,6 +294,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String publishHeapDump(@NotNull String fileNamePrefix) {
|
||||
String fileName = fileNamePrefix + ".hprof.zip";
|
||||
File dumpFile = new File(System.getProperty("teamcity.build.tempDir", System.getProperty("java.io.tmpdir")), fileName);
|
||||
@@ -305,7 +310,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
return dumpPath;
|
||||
}
|
||||
|
||||
@Contract(value = "_ -> fail")
|
||||
@Contract("_ -> fail")
|
||||
public static void reportLeakedProjects(@NotNull TooManyProjectLeakedException e) {
|
||||
TIntHashSet hashCodes = new TIntHashSet();
|
||||
for (Project project : e.getLeakedProjects()) {
|
||||
@@ -395,22 +400,22 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module createModule(@NonNls final String moduleName) {
|
||||
protected Module createModule(@NonNls @NotNull String moduleName) {
|
||||
return doCreateRealModule(moduleName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module doCreateRealModule(final String moduleName) {
|
||||
protected Module doCreateRealModule(@NotNull String moduleName) {
|
||||
return doCreateRealModuleIn(moduleName, myProject, getModuleType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module doCreateRealModuleIn(@NotNull String moduleName, @NotNull Project project, final ModuleType moduleType) {
|
||||
protected Module doCreateRealModuleIn(@NotNull String moduleName, @NotNull Project project, @NotNull ModuleType moduleType) {
|
||||
return createModuleAt(moduleName, project, moduleType, Objects.requireNonNull(project.getBasePath()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Module createModuleAt(@NotNull String moduleName, @NotNull Project project, ModuleType moduleType, @NotNull String path) {
|
||||
protected Module createModuleAt(@NotNull String moduleName, @NotNull Project project, @NotNull ModuleType moduleType, @NotNull String path) {
|
||||
if (isCreateProjectFileExplicitly()) {
|
||||
File moduleFile = new File(FileUtil.toSystemDependentName(path), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
|
||||
FileUtil.createIfDoesntExist(moduleFile);
|
||||
@@ -429,11 +434,12 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
() -> moduleManager.newModule(path + File.separatorChar + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION, moduleType.getId()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ModuleType getModuleType() {
|
||||
return EmptyModuleType.getInstance();
|
||||
}
|
||||
|
||||
public static void cleanupApplicationCaches(Project project) {
|
||||
public static void cleanupApplicationCaches(@Nullable Project project) {
|
||||
UndoManagerImpl globalInstance = (UndoManagerImpl)UndoManager.getGlobalInstance();
|
||||
if (globalInstance != null) {
|
||||
globalInstance.dropHistoryInTests();
|
||||
@@ -463,6 +469,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Set<VirtualFile> eternallyLivingFiles() {
|
||||
if (ourEternallyLivingFilesCache != null) {
|
||||
return ourEternallyLivingFilesCache;
|
||||
@@ -486,14 +493,14 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerSurvivor(Set<? super VirtualFile> survivors, VirtualFile file) {
|
||||
private static void registerSurvivor(@NotNull Set<? super VirtualFile> survivors, @NotNull VirtualFile file) {
|
||||
addSubTree(file, survivors);
|
||||
while (file != null && survivors.add(file)) {
|
||||
file = file.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
private static void addSubTree(VirtualFile root, Set<? super VirtualFile> to) {
|
||||
private static void addSubTree(@NotNull VirtualFile root, @NotNull Set<? super VirtualFile> to) {
|
||||
if (root instanceof VirtualDirectoryImpl) {
|
||||
for (VirtualFile child : ((VirtualDirectoryImpl)root).getCachedChildren()) {
|
||||
if (child instanceof VirtualDirectoryImpl) {
|
||||
@@ -602,7 +609,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
return disposable;
|
||||
}
|
||||
|
||||
private void resetClassFields(final Class<?> aClass) {
|
||||
private void resetClassFields(@NotNull Class<?> aClass) {
|
||||
try {
|
||||
clearDeclaredFields(this, aClass);
|
||||
}
|
||||
@@ -715,7 +722,7 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
}
|
||||
|
||||
protected void runBareRunnable(ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
protected void runBareRunnable(@NotNull ThrowableRunnable<Throwable> runnable) throws Throwable {
|
||||
if (runInDispatchThread()) {
|
||||
EdtTestUtil.runInEdtAndWait(runnable);
|
||||
}
|
||||
@@ -826,11 +833,11 @@ public abstract class PlatformTestCase extends UsefulTestCase implements DataPro
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected PsiFile getPsiFile(final Document document) {
|
||||
protected PsiFile getPsiFile(@NotNull Document document) {
|
||||
return PsiDocumentManager.getInstance(getProject()).getPsiFile(document);
|
||||
}
|
||||
|
||||
private static void setPlatformPrefix(String prefix) {
|
||||
private static void setPlatformPrefix(@NotNull String prefix) {
|
||||
System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix);
|
||||
ourPlatformPrefixInitialized = true;
|
||||
}
|
||||
|
||||
@@ -46,38 +46,35 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class PsiTestUtil {
|
||||
public static VirtualFile createTestProjectStructure(Project project,
|
||||
Module module,
|
||||
@NotNull
|
||||
public static VirtualFile createTestProjectStructure(@NotNull Project project,
|
||||
@NotNull Module module,
|
||||
String rootPath,
|
||||
Collection<? super File> filesToDelete) throws Exception {
|
||||
@NotNull Collection<? super File> filesToDelete) throws Exception {
|
||||
return createTestProjectStructure(project, module, rootPath, filesToDelete, true);
|
||||
}
|
||||
|
||||
public static VirtualFile createTestProjectStructure(Project project, Module module, Collection<? super File> filesToDelete) throws IOException {
|
||||
@NotNull
|
||||
public static VirtualFile createTestProjectStructure(@NotNull Project project, @NotNull Module module, @NotNull Collection<? super File> filesToDelete) throws IOException {
|
||||
return createTestProjectStructure(project, module, null, filesToDelete, true);
|
||||
}
|
||||
|
||||
public static VirtualFile createTestProjectStructure(Project project,
|
||||
Module module,
|
||||
@NotNull
|
||||
public static VirtualFile createTestProjectStructure(@NotNull Project project,
|
||||
@Nullable Module module,
|
||||
String rootPath,
|
||||
Collection<? super File> filesToDelete,
|
||||
@NotNull Collection<? super File> filesToDelete,
|
||||
boolean addProjectRoots) throws IOException {
|
||||
VirtualFile vDir = createTestProjectStructure(module, rootPath, filesToDelete, addProjectRoots);
|
||||
VirtualFile vDir = createTestProjectStructure("unitTest", module, rootPath, filesToDelete, addProjectRoots);
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
return vDir;
|
||||
}
|
||||
|
||||
public static VirtualFile createTestProjectStructure(Module module,
|
||||
@NotNull
|
||||
public static VirtualFile createTestProjectStructure(@NotNull String tempName,
|
||||
@Nullable Module module,
|
||||
String rootPath,
|
||||
Collection<? super File> filesToDelete,
|
||||
boolean addProjectRoots) throws IOException {
|
||||
return createTestProjectStructure("unitTest", module, rootPath, filesToDelete, addProjectRoots);
|
||||
}
|
||||
|
||||
public static VirtualFile createTestProjectStructure(String tempName,
|
||||
Module module,
|
||||
String rootPath,
|
||||
Collection<? super File> filesToDelete,
|
||||
@NotNull Collection<? super File> filesToDelete,
|
||||
boolean addProjectRoots) throws IOException {
|
||||
File dir = FileUtil.createTempDirectory(tempName, null, false);
|
||||
filesToDelete.add(dir);
|
||||
@@ -110,32 +107,38 @@ public class PsiTestUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static SourceFolder addSourceContentToRoots(Module module, @NotNull VirtualFile vDir) {
|
||||
@NotNull
|
||||
public static SourceFolder addSourceContentToRoots(@NotNull Module module, @NotNull VirtualFile vDir) {
|
||||
return addSourceContentToRoots(module, vDir, false);
|
||||
}
|
||||
|
||||
public static SourceFolder addSourceContentToRoots(Module module, @NotNull VirtualFile vDir, boolean testSource) {
|
||||
@NotNull
|
||||
public static SourceFolder addSourceContentToRoots(@NotNull Module module, @NotNull VirtualFile vDir, boolean testSource) {
|
||||
Ref<SourceFolder> result = Ref.create();
|
||||
ModuleRootModificationUtil.updateModel(module, model -> result.set(model.addContentEntry(vDir).addSourceFolder(vDir, testSource)));
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public static SourceFolder addSourceRoot(Module module, VirtualFile vDir) {
|
||||
@NotNull
|
||||
public static SourceFolder addSourceRoot(@NotNull Module module, @NotNull VirtualFile vDir) {
|
||||
return addSourceRoot(module, vDir, false);
|
||||
}
|
||||
|
||||
public static SourceFolder addSourceRoot(Module module, VirtualFile vDir, boolean isTestSource) {
|
||||
@NotNull
|
||||
public static SourceFolder addSourceRoot(@NotNull Module module, @NotNull VirtualFile vDir, boolean isTestSource) {
|
||||
return addSourceRoot(module, vDir, isTestSource ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE);
|
||||
}
|
||||
|
||||
public static <P extends JpsElement> SourceFolder addSourceRoot(Module module, VirtualFile vDir, @NotNull JpsModuleSourceRootType<P> rootType) {
|
||||
@NotNull
|
||||
public static <P extends JpsElement> SourceFolder addSourceRoot(@NotNull Module module, @NotNull VirtualFile vDir, @NotNull JpsModuleSourceRootType<P> rootType) {
|
||||
return addSourceRoot(module, vDir, rootType, rootType.createDefaultProperties());
|
||||
}
|
||||
|
||||
public static <P extends JpsElement> SourceFolder addSourceRoot(Module module,
|
||||
VirtualFile vDir,
|
||||
@NotNull JpsModuleSourceRootType<P> rootType,
|
||||
P properties) {
|
||||
@NotNull
|
||||
public static <P extends JpsElement> SourceFolder addSourceRoot(@NotNull Module module,
|
||||
@NotNull VirtualFile vDir,
|
||||
@NotNull JpsModuleSourceRootType<P> rootType,
|
||||
@NotNull P properties) {
|
||||
Ref<SourceFolder> result = Ref.create();
|
||||
ModuleRootModificationUtil.updateModel(module, model -> {
|
||||
ContentEntry entry = findContentEntry(model, vDir);
|
||||
@@ -146,14 +149,14 @@ public class PsiTestUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ContentEntry findContentEntry(ModuleRootModel rootModel, VirtualFile file) {
|
||||
private static ContentEntry findContentEntry(@NotNull ModuleRootModel rootModel, @NotNull VirtualFile file) {
|
||||
return ContainerUtil.find(rootModel.getContentEntries(), object -> {
|
||||
VirtualFile entryRoot = object.getFile();
|
||||
return entryRoot != null && VfsUtilCore.isAncestor(entryRoot, file, false);
|
||||
});
|
||||
}
|
||||
|
||||
public static ContentEntry addContentRoot(Module module, VirtualFile vDir) {
|
||||
public static ContentEntry addContentRoot(@NotNull Module module, @NotNull VirtualFile vDir) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> model.addContentEntry(vDir));
|
||||
|
||||
for (ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) {
|
||||
@@ -166,14 +169,14 @@ public class PsiTestUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addExcludedRoot(Module module, VirtualFile dir) {
|
||||
public static void addExcludedRoot(@NotNull Module module, @NotNull VirtualFile dir) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> ApplicationManager.getApplication().runReadAction(() -> {
|
||||
findContentEntryWithAssertion(model, dir).addExcludeFolder(dir);
|
||||
}));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ContentEntry findContentEntryWithAssertion(ModifiableRootModel model, VirtualFile dir) {
|
||||
private static ContentEntry findContentEntryWithAssertion(@NotNull ModifiableRootModel model, @NotNull VirtualFile dir) {
|
||||
ContentEntry entry = findContentEntry(model, dir);
|
||||
if (entry == null) {
|
||||
throw new RuntimeException(dir + " is not under content roots: " + Arrays.toString(model.getContentRoots()));
|
||||
@@ -181,7 +184,7 @@ public class PsiTestUtil {
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static void removeContentEntry(Module module, VirtualFile contentRoot) {
|
||||
public static void removeContentEntry(@NotNull Module module, @NotNull VirtualFile contentRoot) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> model.removeContentEntry(findContentEntryWithAssertion(model, contentRoot)));
|
||||
}
|
||||
|
||||
@@ -197,14 +200,14 @@ public class PsiTestUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void removeExcludedRoot(Module module, VirtualFile root) {
|
||||
public static void removeExcludedRoot(@NotNull Module module, @NotNull VirtualFile root) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> {
|
||||
ContentEntry entry = findContentEntryWithAssertion(model, root);
|
||||
entry.removeExcludeFolder(root.getUrl());
|
||||
});
|
||||
}
|
||||
|
||||
public static void checkErrorElements(PsiElement element) {
|
||||
public static void checkErrorElements(@NotNull PsiElement element) {
|
||||
StringBuilder err = null;
|
||||
int s = 0;
|
||||
String text = element.getText();
|
||||
@@ -222,11 +225,11 @@ public class PsiTestUtil {
|
||||
UsefulTestCase.assertSameLines(text, err.toString());
|
||||
}
|
||||
|
||||
public static void checkFileStructure(PsiFile file) {
|
||||
public static void checkFileStructure(@NotNull PsiFile file) {
|
||||
compareFromAllRoots(file, f -> DebugUtil.psiTreeToString(f, false));
|
||||
}
|
||||
|
||||
private static void compareFromAllRoots(PsiFile file, Function<? super PsiFile, String> fun) {
|
||||
private static void compareFromAllRoots(@NotNull PsiFile file, @NotNull Function<? super PsiFile, String> fun) {
|
||||
PsiFile dummyFile = createDummyCopy(file);
|
||||
|
||||
String psiTree = StringUtil.join(file.getViewProvider().getAllFiles(), fun, "\n");
|
||||
@@ -234,7 +237,7 @@ public class PsiTestUtil {
|
||||
assertPsiTextTreeConsistency(psiTree, reparsedTree);
|
||||
}
|
||||
|
||||
private static void assertPsiTextTreeConsistency(String psiTree, String reparsedTree) {
|
||||
private static void assertPsiTextTreeConsistency(@NotNull String psiTree, @NotNull String reparsedTree) {
|
||||
if (!psiTree.equals(reparsedTree)) {
|
||||
String[] psiLines = StringUtil.splitByLinesDontTrim(psiTree);
|
||||
String[] reparsedLines = StringUtil.splitByLinesDontTrim(reparsedTree);
|
||||
@@ -252,7 +255,7 @@ public class PsiTestUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiFile createDummyCopy(PsiFile file) {
|
||||
private static PsiFile createDummyCopy(@NotNull PsiFile file) {
|
||||
LightVirtualFile copy = new LightVirtualFile(file.getName(), file.getText());
|
||||
copy.setOriginalFile(file.getViewProvider().getVirtualFile());
|
||||
PsiFile dummyCopy = Objects.requireNonNull(file.getManager().findFile(copy));
|
||||
@@ -262,7 +265,7 @@ public class PsiTestUtil {
|
||||
return dummyCopy;
|
||||
}
|
||||
|
||||
public static void checkPsiMatchesTextIgnoringNonCode(PsiFile file) {
|
||||
public static void checkPsiMatchesTextIgnoringNonCode(@NotNull PsiFile file) {
|
||||
compareFromAllRoots(file, f -> DebugUtil.psiToStringIgnoringNonCode(f));
|
||||
}
|
||||
|
||||
@@ -280,20 +283,21 @@ public class PsiTestUtil {
|
||||
* @param name a name for the library
|
||||
* @return new {@link LibraryBuilder}.
|
||||
*/
|
||||
@NotNull
|
||||
public static LibraryBuilder newLibrary(String name) {
|
||||
return new LibraryBuilder(name);
|
||||
}
|
||||
|
||||
public static void addLibrary(Module module, String libPath) {
|
||||
public static void addLibrary(@NotNull Module module, @NotNull String libPath) {
|
||||
File file = new File(libPath);
|
||||
String libName = file.getName();
|
||||
addLibrary(module, libName, file.getParent(), libName);
|
||||
}
|
||||
|
||||
public static void addLibrary(Module module, String libName, String libPath, String... jarArr) {
|
||||
public static void addLibrary(@NotNull Module module, String libName, @NotNull String libPath, @NotNull String... jarArr) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> addLibrary(module, model, libName, libPath, jarArr));
|
||||
}
|
||||
public static void addLibrary(@NotNull Disposable parent, Module module, String libName, String libPath, String... jarArr) {
|
||||
public static void addLibrary(@NotNull Disposable parent, @NotNull Module module, String libName, @NotNull String libPath, @NotNull String... jarArr) {
|
||||
Ref<Library> ref = new Ref<>();
|
||||
ModuleRootModificationUtil.updateModel(module, model -> ref.set(addLibrary(module, model, libName, libPath, jarArr)));
|
||||
Disposer.register(parent, () -> {
|
||||
@@ -313,26 +317,27 @@ public class PsiTestUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void addProjectLibrary(Module module, String libName, List<String> classesRootPaths) {
|
||||
public static void addProjectLibrary(@NotNull Module module, String libName, @NotNull List<String> classesRootPaths) {
|
||||
List<VirtualFile> roots = getLibraryRoots(classesRootPaths);
|
||||
addProjectLibrary(module, libName, roots, Collections.emptyList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<VirtualFile> getLibraryRoots(List<String> classesRootPaths) {
|
||||
private static List<VirtualFile> getLibraryRoots(@NotNull List<String> classesRootPaths) {
|
||||
return ContainerUtil.map(classesRootPaths, path -> VirtualFileManager.getInstance().refreshAndFindFileByUrl(VfsUtil.getUrlForLibraryRoot(new File(path))));
|
||||
}
|
||||
|
||||
public static void addProjectLibrary(ModifiableRootModel model, String libName, List<String> classesRootPaths) {
|
||||
public static void addProjectLibrary(@NotNull ModifiableRootModel model, String libName, @NotNull List<String> classesRootPaths) {
|
||||
List<VirtualFile> roots = getLibraryRoots(classesRootPaths);
|
||||
addProjectLibrary(model, libName, roots, Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static void addProjectLibrary(Module module, String libName, VirtualFile... classesRoots) {
|
||||
public static void addProjectLibrary(@NotNull Module module, String libName, @NotNull VirtualFile... classesRoots) {
|
||||
addProjectLibrary(module, libName, Arrays.asList(classesRoots), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static Library addProjectLibrary(Module module, String libName, List<? extends VirtualFile> classesRoots, List<? extends VirtualFile> sourceRoots) {
|
||||
@NotNull
|
||||
public static Library addProjectLibrary(@NotNull Module module, String libName, @NotNull List<? extends VirtualFile> classesRoots, @NotNull List<? extends VirtualFile> sourceRoots) {
|
||||
Ref<Library> result = Ref.create();
|
||||
ModuleRootModificationUtil.updateModel(
|
||||
module, model -> result.set(addProjectLibrary(model, libName, classesRoots, sourceRoots, Collections.emptyList())));
|
||||
@@ -340,11 +345,11 @@ public class PsiTestUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Library addProjectLibrary(ModifiableRootModel model,
|
||||
private static Library addProjectLibrary(@NotNull ModifiableRootModel model,
|
||||
String libName,
|
||||
List<? extends VirtualFile> classesRoots,
|
||||
List<? extends VirtualFile> sourceRoots,
|
||||
List<? extends VirtualFile> javaDocs) {
|
||||
@NotNull List<? extends VirtualFile> classesRoots,
|
||||
@NotNull List<? extends VirtualFile> sourceRoots,
|
||||
@NotNull List<? extends VirtualFile> javaDocs) {
|
||||
LibraryTable libraryTable = ProjectLibraryTable.getInstance(model.getProject());
|
||||
return WriteAction.computeAndWait(() -> {
|
||||
Library library = libraryTable.createLibrary(libName);
|
||||
@@ -378,11 +383,11 @@ public class PsiTestUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Library addLibrary(Module module,
|
||||
ModifiableRootModel model,
|
||||
public static Library addLibrary(@NotNull Module module,
|
||||
@NotNull ModifiableRootModel model,
|
||||
String libName,
|
||||
String libPath,
|
||||
String... jarArr) {
|
||||
@NotNull String libPath,
|
||||
@NotNull String... jarArr) {
|
||||
List<VirtualFile> classesRoots = new ArrayList<>();
|
||||
for (String jar : jarArr) {
|
||||
if (!libPath.endsWith("/") && !jar.startsWith("/")) {
|
||||
@@ -402,10 +407,11 @@ public class PsiTestUtil {
|
||||
return addProjectLibrary(model, libName, classesRoots, Collections.emptyList(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public static void addLibrary(Module module,
|
||||
String libName, String libDir,
|
||||
String[] classRoots,
|
||||
String[] sourceRoots) {
|
||||
public static void addLibrary(@NotNull Module module,
|
||||
String libName,
|
||||
@NotNull String libDir,
|
||||
@NotNull String[] classRoots,
|
||||
@NotNull String[] sourceRoots) {
|
||||
String proto = (classRoots.length > 0 ? classRoots[0] : sourceRoots[0]).endsWith(".jar!/") ? JarFileSystem.PROTOCOL : LocalFileSystem.PROTOCOL;
|
||||
String parentUrl = VirtualFileManager.constructUrl(proto, libDir);
|
||||
List<String> classesUrls = new ArrayList<>();
|
||||
@@ -419,7 +425,8 @@ public class PsiTestUtil {
|
||||
ModuleRootModificationUtil.addModuleLibrary(module, libName, classesUrls, sourceUrls);
|
||||
}
|
||||
|
||||
public static Module addModule(Project project, ModuleType type, String name, VirtualFile root) {
|
||||
@NotNull
|
||||
public static Module addModule(@NotNull Project project, @NotNull ModuleType type, @NotNull String name, @NotNull VirtualFile root) {
|
||||
return WriteCommandAction.writeCommandAction(project).compute(() -> {
|
||||
String moduleName;
|
||||
ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel();
|
||||
@@ -448,7 +455,7 @@ public class PsiTestUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void setCompilerOutputPath(Module module, String url, boolean forTests) {
|
||||
public static void setCompilerOutputPath(@NotNull Module module, @NotNull String url, boolean forTests) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> {
|
||||
CompilerModuleExtension extension = model.getModuleExtension(CompilerModuleExtension.class);
|
||||
extension.inheritCompilerOutputPath(false);
|
||||
@@ -461,11 +468,11 @@ public class PsiTestUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void setExcludeCompileOutput(Module module, boolean exclude) {
|
||||
public static void setExcludeCompileOutput(@NotNull Module module, boolean exclude) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> model.getModuleExtension(CompilerModuleExtension.class).setExcludeOutput(exclude));
|
||||
}
|
||||
|
||||
public static void setJavadocUrls(Module module, String... urls) {
|
||||
public static void setJavadocUrls(@NotNull Module module, @NotNull String... urls) {
|
||||
ModuleRootModificationUtil.updateModel(module, model -> model.getModuleExtension(JavaModuleExternalPaths.class).setJavadocUrls(urls));
|
||||
}
|
||||
|
||||
@@ -511,7 +518,7 @@ public class PsiTestUtil {
|
||||
throw e;
|
||||
}
|
||||
|
||||
public static void checkPsiStructureWithCommit(@NotNull PsiFile psiFile, Consumer<? super PsiFile> checker) {
|
||||
public static void checkPsiStructureWithCommit(@NotNull PsiFile psiFile, @NotNull Consumer<? super PsiFile> checker) {
|
||||
checker.accept(psiFile);
|
||||
Document document = psiFile.getViewProvider().getDocument();
|
||||
PsiDocumentManager manager = PsiDocumentManager.getInstance(psiFile.getProject());
|
||||
@@ -536,7 +543,8 @@ public class PsiTestUtil {
|
||||
* @param root root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder classesRoot(VirtualFile root) {
|
||||
@NotNull
|
||||
public LibraryBuilder classesRoot(@NotNull VirtualFile root) {
|
||||
myClassesRoots.add(root);
|
||||
return this;
|
||||
}
|
||||
@@ -546,7 +554,8 @@ public class PsiTestUtil {
|
||||
* @param rootPath root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder classesRoot(String rootPath) {
|
||||
@NotNull
|
||||
public LibraryBuilder classesRoot(@NotNull String rootPath) {
|
||||
myClassesRoots.add(VirtualFileManager.getInstance().refreshAndFindFileByUrl(VfsUtil.getUrlForLibraryRoot(new File(rootPath))));
|
||||
return this;
|
||||
}
|
||||
@@ -556,7 +565,8 @@ public class PsiTestUtil {
|
||||
* @param root root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder sourceRoot(VirtualFile root) {
|
||||
@NotNull
|
||||
public LibraryBuilder sourceRoot(@NotNull VirtualFile root) {
|
||||
mySourceRoots.add(root);
|
||||
return this;
|
||||
}
|
||||
@@ -566,7 +576,8 @@ public class PsiTestUtil {
|
||||
* @param rootPath root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder sourceRoot(String rootPath) {
|
||||
@NotNull
|
||||
public LibraryBuilder sourceRoot(@NotNull String rootPath) {
|
||||
mySourceRoots.add(VirtualFileManager.getInstance().refreshAndFindFileByUrl(VfsUtil.getUrlForLibraryRoot(new File(rootPath))));
|
||||
return this;
|
||||
}
|
||||
@@ -576,7 +587,8 @@ public class PsiTestUtil {
|
||||
* @param root root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder javaDocRoot(VirtualFile root) {
|
||||
@NotNull
|
||||
public LibraryBuilder javaDocRoot(@NotNull VirtualFile root) {
|
||||
myJavaDocRoots.add(root);
|
||||
return this;
|
||||
}
|
||||
@@ -586,7 +598,8 @@ public class PsiTestUtil {
|
||||
* @param rootPath root to add
|
||||
* @return this builder
|
||||
*/
|
||||
public LibraryBuilder javaDocRoot(String rootPath) {
|
||||
@NotNull
|
||||
public LibraryBuilder javaDocRoot(@NotNull String rootPath) {
|
||||
myJavaDocRoots.add(VirtualFileManager.getInstance().refreshAndFindFileByUrl(VfsUtil.getUrlForLibraryRoot(new File(rootPath))));
|
||||
return this;
|
||||
}
|
||||
@@ -598,7 +611,8 @@ public class PsiTestUtil {
|
||||
* @param model a model to register the library in.
|
||||
* @return a library
|
||||
*/
|
||||
public Library addTo(ModifiableRootModel model) {
|
||||
@NotNull
|
||||
public Library addTo(@NotNull ModifiableRootModel model) {
|
||||
return addProjectLibrary(model, myName, myClassesRoots, mySourceRoots, myJavaDocRoots);
|
||||
}
|
||||
|
||||
@@ -610,7 +624,8 @@ public class PsiTestUtil {
|
||||
* @param module a module to register the library in.
|
||||
* @return a library
|
||||
*/
|
||||
public Library addTo(Module module) {
|
||||
@NotNull
|
||||
public Library addTo(@NotNull Module module) {
|
||||
Ref<Library> result = Ref.create();
|
||||
ModuleRootModificationUtil.updateModel(module, model -> result.set(addTo(model)));
|
||||
return result.get();
|
||||
|
||||
@@ -450,6 +450,7 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
EdtTestUtil.runInEdtAndWait(runnable);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String toString(@NotNull Iterable<?> collection) {
|
||||
if (!collection.iterator().hasNext()) {
|
||||
return "<empty>";
|
||||
@@ -475,7 +476,7 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> void assertOrderedEquals(@NotNull Iterable<? extends T> actual, @NotNull T... expected) {
|
||||
assertOrderedEquals(null, actual, expected);
|
||||
assertOrderedEquals("", actual, expected);
|
||||
}
|
||||
|
||||
public static void assertOrderedEquals(@NotNull byte[] actual, @NotNull byte[] expected) {
|
||||
@@ -499,22 +500,22 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> void assertOrderedEquals(String errorMsg, @NotNull Iterable<? extends T> actual, @NotNull T... expected) {
|
||||
public static <T> void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable<? extends T> actual, @NotNull T... expected) {
|
||||
assertOrderedEquals(errorMsg, actual, Arrays.asList(expected));
|
||||
}
|
||||
|
||||
public static <T> void assertOrderedEquals(@NotNull Iterable<? extends T> actual, @NotNull Iterable<? extends T> expected) {
|
||||
assertOrderedEquals(null, actual, expected);
|
||||
assertOrderedEquals("", actual, expected);
|
||||
}
|
||||
|
||||
public static <T> void assertOrderedEquals(String errorMsg,
|
||||
public static <T> void assertOrderedEquals(@NotNull String errorMsg,
|
||||
@NotNull Iterable<? extends T> actual,
|
||||
@NotNull Iterable<? extends T> expected) {
|
||||
//noinspection unchecked
|
||||
assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL);
|
||||
}
|
||||
|
||||
public static <T> void assertOrderedEquals(String errorMsg,
|
||||
public static <T> void assertOrderedEquals(@NotNull String errorMsg,
|
||||
@NotNull Iterable<? extends T> actual,
|
||||
@NotNull Iterable<? extends T> expected,
|
||||
@NotNull Equality<? super T> comparator) {
|
||||
@@ -563,13 +564,13 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
* Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order
|
||||
*/
|
||||
public static <T> void assertSameElements(@NotNull Collection<? extends T> actual, @NotNull Collection<? extends T> expected) {
|
||||
assertSameElements(null, actual, expected);
|
||||
assertSameElements("", actual, expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order
|
||||
*/
|
||||
public static <T> void assertSameElements(String message, @NotNull Collection<? extends T> actual, @NotNull Collection<? extends T> expected) {
|
||||
public static <T> void assertSameElements(@NotNull String message, @NotNull Collection<? extends T> actual, @NotNull Collection<? extends T> expected) {
|
||||
if (actual.size() != expected.size() || !new HashSet<>(expected).equals(new HashSet<T>(actual))) {
|
||||
Assert.assertEquals(message, new HashSet<>(expected), new HashSet<T>(actual));
|
||||
}
|
||||
@@ -757,14 +758,14 @@ public abstract class UsefulTestCase extends TestCase {
|
||||
|
||||
public static void assertNullOrEmpty(@Nullable Collection<?> collection) {
|
||||
if (collection == null) return;
|
||||
assertEmpty(null, collection);
|
||||
assertEmpty("", collection);
|
||||
}
|
||||
|
||||
public static void assertEmpty(final String s) {
|
||||
assertTrue(s, StringUtil.isEmpty(s));
|
||||
}
|
||||
|
||||
public static <T> void assertEmpty(@Nullable String errorMsg, @NotNull Collection<? extends T> collection) {
|
||||
public static <T> void assertEmpty(@NotNull String errorMsg, @NotNull Collection<? extends T> collection) {
|
||||
assertOrderedEquals(errorMsg, collection, Collections.emptyList());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.util.List;
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
@HardwareAgentRequired
|
||||
public class AntHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/highlighting/";
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.testFramework.ResolveTestCase;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomTarget;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AntResolveTest extends ResolveTestCase {
|
||||
|
||||
@@ -291,6 +292,7 @@ public class AntResolveTest extends ResolveTestCase {
|
||||
assertTrue(target instanceof PomTargetPsiElement && ((PomTargetPsiElement)target).getTarget().canNavigateToSource());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("ant") + "/tests/data/psi/resolve/";
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ public class GrTurnRefsToSuperTest extends MultiFileTestCase {
|
||||
return "/refactoring/turnRefsToSuper/";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return TestUtils.getAbsoluteTestDataPath();
|
||||
|
||||
@@ -22,12 +22,14 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Maxim.Mossienko
|
||||
*/
|
||||
public class PropertiesFindUsagesTest extends CodeInsightTestCase {
|
||||
private static final String BASE_PATH = "testData/findUsages/";
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("java-i18n") + "/";
|
||||
|
||||
@@ -39,6 +39,7 @@ public class PropertiesPerformanceTest extends CodeInsightTestCase {
|
||||
return module != null ? module : super.createMainModule();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("java-i18n") + "/testData/performance/";
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.psi.PsiPolyVariantReference;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
@@ -62,6 +63,7 @@ public class PropertiesResolveTest extends CodeInsightTestCase{
|
||||
assertTrue(elementText.contains(unescapedKey));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("java-i18n") + "/";
|
||||
|
||||
@@ -61,6 +61,7 @@ public class RenamePropertyTest extends MultiFileTestCase {
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("java-i18n") + "/";
|
||||
|
||||
@@ -36,6 +36,7 @@ public class RenameUIRelatedTest extends MultiFileTestCase {
|
||||
return "/renameUIRelated/";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("ui-designer") + "/testData";
|
||||
|
||||
@@ -3,8 +3,10 @@ package org.jetbrains.yaml.schema;
|
||||
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.jetbrains.jsonSchema.JsonBySchemaDocumentationBaseTest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class YamlByJsonSchemaDocumentationTest extends JsonBySchemaDocumentationBaseTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestDataPath() {
|
||||
return PathManagerEx.getCommunityHomePath() + "/plugins/yaml/testSrc/org/jetbrains/yaml/schema/data";
|
||||
|
||||
+2
@@ -13,9 +13,11 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.jetbrains.jsonSchema.impl.JsonBySchemaHeavyCompletionTest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class YamlByJsonSchemaHeavyCompletionTest extends JsonBySchemaHeavyCompletionTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestDataPath() {
|
||||
return PathManagerEx.getCommunityHomePath() + "/plugins/yaml/testSrc/org/jetbrains/yaml/schema/data/completion";
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.Predicate;
|
||||
import com.jetbrains.jsonSchema.JsonSchemaHighlightingTestBase;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.yaml.YAMLLanguage;
|
||||
|
||||
import java.io.File;
|
||||
@@ -17,6 +18,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class YamlByJsonSchemaHighlightingTest extends JsonSchemaHighlightingTestBase {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTestDataPath() {
|
||||
return PathManagerEx.getCommunityHomePath() + "/plugins/yaml/testSrc/org/jetbrains/yaml/schema/data/highlighting";
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.testFramework.TestDataPath;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.psi.PyFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -108,6 +109,7 @@ public class PyToJavaResolveTest extends ResolveTestCase {
|
||||
assertInstanceOf(targets.get(1), PsiPackage.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PythonHelpersLocator.getPythonCommunityPath() + "/testData/resolve/pyToJava/";
|
||||
|
||||
@@ -2199,6 +2199,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
ExternalResourceManagerEx.getInstanceEx().setDefaultHtmlDoctype(myOldDoctype, getProject());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/";
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.xml.util.CheckDtdReferencesInspection;
|
||||
import com.intellij.xml.util.CheckXmlFileWithXercesValidatorInspection;
|
||||
import com.intellij.xml.util.XmlDuplicatedIdInspection;
|
||||
import com.intellij.xml.util.XmlInvalidIdInspection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -68,6 +69,7 @@ public class XmlStressTest extends DaemonAnalyzerTestCase {
|
||||
getTestRootDisposable());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/";
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.ResolveTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -20,6 +21,7 @@ import java.io.FileWriter;
|
||||
public class XmlResolve2Test extends ResolveTestCase {
|
||||
private static final String BASE_PATH = PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/xml/tests/testData/psi/resolve/namespace/";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return BASE_PATH;
|
||||
|
||||
Reference in New Issue
Block a user