本文整理汇总了Java中com.intellij.JavaTestUtil类的典型用法代码示例。如果您正苦于以下问题:Java JavaTestUtil类的具体用法?Java JavaTestUtil怎么用?Java JavaTestUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaTestUtil类属于com.intellij包,在下文中一共展示了JavaTestUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProject
import com.intellij.JavaTestUtil; //导入依赖的package包/类
private void initProject(String folderName, final String... sourceDirs) {
final String testDir = JavaTestUtil.getJavaTestDataPath() + "/find/" + folderName;
ApplicationManager.getApplication().runWriteAction(() -> {
try{
mySourceDirs = new VirtualFile[sourceDirs.length];
for (int i = 0; i < sourceDirs.length; i++){
String sourcePath = testDir + "/" + sourceDirs[i];
mySourceDirs[i] = LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(sourcePath));
}
VirtualFile projectDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(testDir));
Sdk jdk = IdeaTestUtil.getMockJdk17();
PsiTestUtil.removeAllRoots(myModule, jdk);
PsiTestUtil.addContentRoot(myModule, projectDir);
for (VirtualFile sourceDir : mySourceDirs) {
PsiTestUtil.addSourceRoot(myModule, sourceDir);
}
}
catch (Exception e){
throw new RuntimeException(e);
}
});
}
示例2: restoreSources
import com.intellij.JavaTestUtil; //导入依赖的package包/类
private void restoreSources() {
Runnable runnable = new Runnable() {
@Override
public void run() {
try {
FileUtil.copyDir(new File(JavaTestUtil.getJavaTestDataPath() + "/psi/arrayIndexOutOfBounds/src"),
VfsUtilCore.virtualToIoFile(myProjectRoot));
}
catch (IOException e) {
LOG.error(e);
}
VirtualFileManager.getInstance().syncRefresh();
}
};
CommandProcessor.getInstance().executeCommand(myProject, runnable, "", null);
}
示例3: setupPaths
import com.intellij.JavaTestUtil; //导入依赖的package包/类
public void setupPaths() {
final String basePath = JavaTestUtil.getJavaTestDataPath() + "/psi/libraryOrder/";
final VirtualFile lib1SrcFile = refreshAndFindFile(basePath + "lib1/src");
final VirtualFile lib1classes = refreshAndFindFile(basePath + "lib1/classes");
final VirtualFile lib2SrcFile = refreshAndFindFile(basePath + "lib2/src");
final VirtualFile lib2classes = refreshAndFindFile(basePath + "lib2/classes");
assertTrue(lib1SrcFile != null);
assertTrue(lib2SrcFile != null);
addLibraryWithSourcePath("lib1", lib1classes, lib1SrcFile);
addLibraryWithSourcePath("lib2", lib2classes, lib2SrcFile);
final List<VirtualFile> list = Arrays.asList(OrderEnumerator.orderEntries(myModule).getClassesRoots());
assertTrue(list.contains(lib1classes));
assertTrue(list.contains(lib2classes));
}
示例4: initApplication
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected void initApplication() throws Exception {
super.initApplication();
JavaTestUtil.setupTestJDK();
DebuggerSettings.getInstance().DEBUGGER_TRANSPORT = DebuggerSettings.SOCKET_TRANSPORT;
DebuggerSettings.getInstance().SKIP_CONSTRUCTORS = false;
DebuggerSettings.getInstance().SKIP_GETTERS = false;
NodeRendererSettings.getInstance().getClassRenderer().SHOW_DECLARED_TYPE = true;
}
示例5: setUp
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/repositoryUse/modifyAnnotations";
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("mock 1.5"));
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
示例6: doTest
import com.intellij.JavaTestUtil; //导入依赖的package包/类
private void doTest(String... expected) {
final String dirPath = JavaTestUtil.getJavaTestDataPath() + FileUtil.toSystemDependentName("/ide/sourceRootDetection/" + getTestName(true));
final File dir = new File(dirPath);
assertTrue(dir.isDirectory());
final List<Pair<File, String>> actual = new ArrayList<Pair<File, String>>();
for (JavaModuleSourceRoot root : JavaSourceRootDetectionUtil.suggestRoots(dir)) {
actual.add(Pair.create(root.getDirectory(), root.getPackagePrefix()));
}
List<Pair<File, String>> expectedList = new ArrayList<Pair<File, String>>();
for (int i = 0; i < expected.length / 2; i++) {
expectedList.add(Pair.create(new File(dir, expected[2 * i]), expected[2 * i + 1]));
}
assertSameElements(actual, expectedList);
}
示例7: setUp
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/findUsages/" + getTestName(true);
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
示例8: setUp
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/search/" + getTestName(true);
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
}
示例9: testPackageInfo
import com.intellij.JavaTestUtil; //导入依赖的package包/类
public void testPackageInfo() throws Exception {
final String path = JavaTestUtil.getJavaTestDataPath() + "/codeInsight/javadocIG/";
final String packageInfo = path + getTestName(true);
PsiTestUtil.createTestProjectStructure(myProject, myModule, path, myFilesToDelete);
final String info =
new JavaDocInfoGenerator(getProject(), JavaPsiFacade.getInstance(getProject()).findPackage(getTestName(true))).generateDocInfo(null);
String htmlText = FileUtil.loadFile(new File(packageInfo + File.separator + "packageInfo.html"));
assertNotNull(info);
assertEquals(StringUtil.convertLineSeparators(htmlText.trim()), replaceEnvironmentDependentContent(info));
}
示例10: setUpProject
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected void setUpProject() throws Exception {
final String root = JavaTestUtil.getJavaTestDataPath() + "/codeInsight/navigation/alexProject";
VirtualFile vfsRoot = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(root));
VirtualFile projectFile = vfsRoot.findChild("test.ipr");
myProject = ProjectManagerEx.getInstanceEx().loadProject(projectFile.getPath());
ProjectManagerEx.getInstanceEx().openTestProject(myProject);
UIUtil.dispatchAllInvocationEvents(); // startup activities
}
示例11: getTestDataPath
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@NotNull
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() +
"/psi/autodetect/";
}
示例12: getTestDataPath
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
示例13: getBasePath
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/suspiciousCalls";
}
示例14: getTestDataPath
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@NotNull
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath() + "/inspection/guarded";
}
示例15: getBasePath
import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getBasePath() {
return JavaTestUtil.getRelativeJavaTestDataPath();
}