Search in sources :

Example 1 with JavaModuleFixtureBuilder

use of com.intellij.testFramework.builders.JavaModuleFixtureBuilder in project intellij-community by JetBrains.

the class JavaCodeInsightFixtureTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
    myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
    final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
    if (toAddSourceRoot()) {
        moduleFixtureBuilder.addSourceContentRoot(myFixture.getTempDirPath());
    } else {
        moduleFixtureBuilder.addContentRoot(myFixture.getTempDirPath());
    }
    tuneFixture(moduleFixtureBuilder);
    myFixture.setUp();
    myFixture.setTestDataPath(getTestDataPath());
    myModule = moduleFixtureBuilder.getFixture().getModule();
    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_6);
}
Also used : JavaModuleFixtureBuilder(com.intellij.testFramework.builders.JavaModuleFixtureBuilder)

Example 2 with JavaModuleFixtureBuilder

use of com.intellij.testFramework.builders.JavaModuleFixtureBuilder in project intellij-community by JetBrains.

the class SuppressExternalTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
    final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getName());
    myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
    myFixture.setTestDataPath(PathManagerEx.getTestDataPath() + "/codeInsight/externalAnnotations");
    final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
    new File(myFixture.getTempDirPath() + "/src/").mkdir();
    builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src");
    builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
    myFixture.setUp();
    myFixture.enableInspections(new SillyAssignmentInspection());
    addAnnotationsModuleRoot();
    final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject());
    myLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
    LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
}
Also used : JavaPsiFacade(com.intellij.psi.JavaPsiFacade) JavaModuleFixtureBuilder(com.intellij.testFramework.builders.JavaModuleFixtureBuilder) SillyAssignmentInspection(com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection) File(java.io.File)

Example 3 with JavaModuleFixtureBuilder

use of com.intellij.testFramework.builders.JavaModuleFixtureBuilder in project intellij-community by JetBrains.

the class AddAnnotationFixTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
    myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
    final String dataPath = PathManagerEx.getTestDataPath() + "/codeInsight/externalAnnotations";
    myFixture.setTestDataPath(dataPath);
    final JavaModuleFixtureBuilder builder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
    builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
    myFixture.setUp();
    myModule = builder.getFixture().getModule();
    myProject = myFixture.getProject();
    CodeStyleSettingsManager.getSettings(myProject).USE_EXTERNAL_ANNOTATIONS = true;
}
Also used : JavaModuleFixtureBuilder(com.intellij.testFramework.builders.JavaModuleFixtureBuilder)

Example 4 with JavaModuleFixtureBuilder

use of com.intellij.testFramework.builders.JavaModuleFixtureBuilder in project android by JetBrains.

the class AndroidTestCase method addModuleWithAndroidFacet.

protected final void addModuleWithAndroidFacet(@NotNull TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder, @NotNull List<MyAdditionalModuleData> modules, @NotNull String dirName, int projectType, boolean isMainModuleDependency) {
    JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
    String moduleDirPath = myFixture.getTempDirPath() + getAdditionalModulePath(dirName);
    //noinspection ResultOfMethodCallIgnored
    new File(moduleDirPath).mkdirs();
    initializeModuleFixtureBuilderWithSrcAndGen(moduleFixtureBuilder, moduleDirPath);
    modules.add(new MyAdditionalModuleData(moduleFixtureBuilder, dirName, projectType, isMainModuleDependency));
}
Also used : JavaModuleFixtureBuilder(com.intellij.testFramework.builders.JavaModuleFixtureBuilder) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 5 with JavaModuleFixtureBuilder

use of com.intellij.testFramework.builders.JavaModuleFixtureBuilder in project intellij-community by JetBrains.

the class ClsGenericsHighlightingTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
    myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
    myFixture.setTestDataPath(PathManagerEx.getTestDataPath() + "/codeInsight/clsHighlighting");
    JavaModuleFixtureBuilder builder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
    builder.setLanguageLevel(getLanguageLevel());
    builder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
    myFixture.setUp();
    myModule = builder.getFixture().getModule();
}
Also used : JavaModuleFixtureBuilder(com.intellij.testFramework.builders.JavaModuleFixtureBuilder)

Aggregations

JavaModuleFixtureBuilder (com.intellij.testFramework.builders.JavaModuleFixtureBuilder)8 File (java.io.File)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 Module (com.intellij.openapi.module.Module)2 IdeaProjectTestFixture (com.intellij.testFramework.fixtures.IdeaProjectTestFixture)2 ArrayList (java.util.ArrayList)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 SillyAssignmentInspection (com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection)1 StartupManagerImpl (com.intellij.ide.startup.impl.StartupManagerImpl)1 LanguageLevelProjectExtension (com.intellij.openapi.roots.LanguageLevelProjectExtension)1 LanguageLevel (com.intellij.pom.java.LanguageLevel)1 JavaPsiFacade (com.intellij.psi.JavaPsiFacade)1 AfterMethod (org.testng.annotations.AfterMethod)1 BeforeMethod (org.testng.annotations.BeforeMethod)1