当前位置: 首页>>代码示例>>Java>>正文


Java JavaTestUtil类代码示例

本文整理汇总了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);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FindManagerTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ArrayIndexOutOfBoundsTest.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LibraryOrderTest.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DebuggerTestCase.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ModifyAnnotationsTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JavaSourceRootDetectionTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FindUsagesTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UsagesInAnalyzingDependenciesTest.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaDocInfoGeneratorTest.java

示例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
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GotoImplementationTest.java

示例11: getTestDataPath

import com.intellij.JavaTestUtil; //导入依赖的package包/类
@NotNull
@Override
protected String getTestDataPath() {
  return JavaTestUtil.getJavaTestDataPath() +
         "/psi/autodetect/";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FormatterBasedLineInfoBuilderTest.java

示例12: getTestDataPath

import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getTestDataPath() {
  return JavaTestUtil.getJavaTestDataPath() + "/inspection";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:EmptyMethodTest.java

示例13: getBasePath

import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getBasePath() {
  return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/suspiciousCalls";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:SuspiciousCollectionMethodCallsTest.java

示例14: getTestDataPath

import com.intellij.JavaTestUtil; //导入依赖的package包/类
@NotNull
@Override
protected String getTestDataPath() {
  return JavaTestUtil.getJavaTestDataPath() + "/inspection/guarded";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FieldAccessedNotGuardedInspectionTest.java

示例15: getBasePath

import com.intellij.JavaTestUtil; //导入依赖的package包/类
@Override
protected String getBasePath() {
  return JavaTestUtil.getRelativeJavaTestDataPath();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ChangeSignatureGestureTest.java


注:本文中的com.intellij.JavaTestUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。