@Override
  protected void setUpModule() {
    super.setUpModule();
    ApplicationManager.getApplication()
        .runWriteAction(
            new Runnable() {
              @Override
              public void run() {
                final String modulePath = getTestAppPath();
                final String srcPath = modulePath + File.separator + "src";
                VirtualFile moduleDir =
                    LocalFileSystem.getInstance()
                        .findFileByPath(modulePath.replace(File.separatorChar, '/'));
                VirtualFile srcDir =
                    LocalFileSystem.getInstance()
                        .findFileByPath(srcPath.replace(File.separatorChar, '/'));

                final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
                PsiTestUtil.removeAllRoots(myModule, rootManager.getSdk());
                PsiTestUtil.addContentRoot(myModule, moduleDir);
                PsiTestUtil.addSourceRoot(myModule, srcDir);
                IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_1_8);
                PsiTestUtil.setCompilerOutputPath(
                    myModule,
                    VfsUtilCore.pathToUrl(
                        FileUtil.toSystemIndependentName(myModuleOutputDir.getAbsolutePath())),
                    false);
              }
            });
  }
Example #2
0
  protected void setUp() throws Exception {
    super.setUp();
    myTempDirectory = FileUtil.createTempDirectory(getTestName(true), "test");
    myFilesToDelete.add(getTestContentFile());
    final File testRoot = new File(getTestDataPath(), getTestPath());
    assertTrue(testRoot.getAbsolutePath(), testRoot.isDirectory());

    final File currentTestRoot = new File(testRoot, getTestDirectoryName());
    assertTrue(currentTestRoot.getAbsolutePath(), currentTestRoot.isDirectory());

    FileUtil.copyDir(currentTestRoot, new File(myTempDirectory, getTestDirectoryName()));

    ApplicationManager.getApplication()
        .runWriteAction(
            new Runnable() {
              public void run() {
                setupContentRoot();
              }
            });
  }
 @Override
 protected void runTest() throws Throwable {
   myChecker.init(getTestName(true));
   super.runTest();
 }