當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。