Search in sources :

Example 1 with CodeInsightTestFixture

use of com.intellij.testFramework.fixtures.CodeInsightTestFixture in project intellij-community by JetBrains.

the class HighlightingTestBase method createContentFixture.

protected CodeInsightTestFixture createContentFixture(IdeaTestFixtureFactory factory) {
    final TestFixtureBuilder<IdeaProjectTestFixture> builder = factory.createFixtureBuilder(getName());
    final EmptyModuleFixtureBuilder moduleBuilder = builder.addModule(EmptyModuleFixtureBuilder.class);
    final IdeaProjectTestFixture fixture = builder.getFixture();
    final CodeInsightTestFixture testFixture = factory.createCodeInsightFixture(fixture);
    final String root = testFixture.getTempDirPath();
    moduleBuilder.addContentRoot(root);
    moduleBuilder.addSourceRoot("/");
    return testFixture;
}
Also used : IdeaProjectTestFixture(com.intellij.testFramework.fixtures.IdeaProjectTestFixture) CodeInsightTestFixture(com.intellij.testFramework.fixtures.CodeInsightTestFixture) EmptyModuleFixtureBuilder(com.intellij.testFramework.builders.EmptyModuleFixtureBuilder)

Example 2 with CodeInsightTestFixture

use of com.intellij.testFramework.fixtures.CodeInsightTestFixture in project google-cloud-intellij by GoogleCloudPlatform.

the class AppEngineCodeInsightTestCase method createCodeInsightFixture.

protected CodeInsightTestFixture createCodeInsightFixture(final String relativeTestDataPath) throws Exception {
    final String testDataPath = new File(getTestDataPath(), relativeTestDataPath).getAbsolutePath();
    final CodeInsightTestFixture codeInsightFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(myProjectFixture);
    codeInsightFixture.setTestDataPath(testDataPath);
    final TempDirTestFixture tempDir = codeInsightFixture.getTempDirFixture();
    myModuleBuilder.addSourceContentRoot(tempDir.getTempDirPath());
    codeInsightFixture.setUp();
    final VirtualFile dir = LocalFileSystem.getInstance().refreshAndFindFileByPath(testDataPath);
    Assert.assertNotNull("Test data directory not found: " + testDataPath, dir);
    VfsUtil.processFilesRecursively(dir, new CommonProcessors.CollectProcessor<VirtualFile>());
    dir.refresh(false, true);
    tempDir.copyAll(testDataPath, "", new VirtualFileFilter() {

        @Override
        public boolean accept(VirtualFile file) {
            return !file.getName().contains("_after");
        }
    });
    return codeInsightFixture;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VirtualFileFilter(com.intellij.openapi.vfs.VirtualFileFilter) TempDirTestFixture(com.intellij.testFramework.fixtures.TempDirTestFixture) CommonProcessors(com.intellij.util.CommonProcessors) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) CodeInsightTestFixture(com.intellij.testFramework.fixtures.CodeInsightTestFixture)

Aggregations

CodeInsightTestFixture (com.intellij.testFramework.fixtures.CodeInsightTestFixture)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 VirtualFileFilter (com.intellij.openapi.vfs.VirtualFileFilter)1 EmptyModuleFixtureBuilder (com.intellij.testFramework.builders.EmptyModuleFixtureBuilder)1 IdeaProjectTestFixture (com.intellij.testFramework.fixtures.IdeaProjectTestFixture)1 TempDirTestFixture (com.intellij.testFramework.fixtures.TempDirTestFixture)1 CommonProcessors (com.intellij.util.CommonProcessors)1 File (java.io.File)1