本文整理汇总了Java中com.intellij.testFramework.fixtures.TestFixtureBuilder.addModule方法的典型用法代码示例。如果您正苦于以下问题:Java TestFixtureBuilder.addModule方法的具体用法?Java TestFixtureBuilder.addModule怎么用?Java TestFixtureBuilder.addModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.testFramework.fixtures.TestFixtureBuilder
的用法示例。
在下文中一共展示了TestFixtureBuilder.addModule方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
// Fixes https://youtrack.jetbrains.com/issue/IDEA-129297. Only occurs in Jenkins.
VfsRootAccess.allowRootAccess(System.getProperty("user.dir"));
final TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder =
JavaTestFixtureFactory.createFixtureBuilder(getName());
myModuleBuilder = fixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
myProjectFixture = fixtureBuilder.getFixture();
myCodeInsightFixture = createCodeInsightFixture(getBaseDirectoryPath());
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
addAppEngineSupport(myProjectFixture.getModule());
}
}.execute();
}
示例2: setUp
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getTestName(false));
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
myFixture.setTestDataPath("/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.enableInspections(new SillyAssignmentInspection());
myFixture.setUp();
addAnnotationsModuleRoot();
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject());
myLanguageLevel = LanguageLevel.HIGHEST; // LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
//LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
}
示例3: createContentFixture
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
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;
}
示例4: addModuleWithAndroidFacet
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
protected void addModuleWithAndroidFacet(@NotNull TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder,
@NotNull List<MyAdditionalModuleData> modules,
@NotNull String dirName,
boolean library) {
final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
final String moduleDirPath = myFixture.getTempDirPath() + getContentRootPath(dirName);
//noinspection ResultOfMethodCallIgnored
new File(moduleDirPath).mkdirs();
tuneModule(moduleFixtureBuilder, moduleDirPath);
modules.add(new MyAdditionalModuleData(moduleFixtureBuilder, dirName, library));
}
示例5: createContentFixture
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
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;
testFixture = factory.createCodeInsightFixture(fixture);
final String root = testFixture.getTempDirPath();
moduleBuilder.addContentRoot(root);
moduleBuilder.addSourceRoot("/");
return testFixture;
}
示例6: setUp
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(false));
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
final String dataPath = "/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();
}
示例7: setUp
import com.intellij.testFramework.fixtures.TestFixtureBuilder; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
// this will throw an exception if we don't have a full Android SDK, so we need to do this first thing before any other setup
String sdkPath = getTestSdkPath();
final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder =
IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
final String dirPath = myFixture.getTempDirPath() + getContentRootPath();
final File dir = new File(dirPath);
if (!dir.exists()) {
assertTrue(dir.mkdirs());
}
tuneModule(moduleFixtureBuilder, dirPath);
final ArrayList<MyAdditionalModuleData> modules = new ArrayList<MyAdditionalModuleData>();
configureAdditionalModules(projectBuilder, modules);
myFixture.setUp();
myFixture.setTestDataPath(getTestDataPath());
myModule = moduleFixtureBuilder.getFixture().getModule();
// Must be done before addAndroidFacet, and must always be done, even if !myCreateManifest.
// We will delete it at the end of setUp; this is needed when unit tests want to rewrite
// the manifest on their own.
createManifest();
myFacet = addAndroidFacet(myModule, sdkPath, getPlatformDir(), isToAddSdk());
LanguageLevel languageLevel = getLanguageLevel();
if (languageLevel != null) {
final LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myModule.getProject());
if (extension != null) {
extension.setLanguageLevel(languageLevel);
}
}
myFixture.copyDirectoryToProject(getResDir(), "res");
myAdditionalModules = new ArrayList<Module>();
for (MyAdditionalModuleData data : modules) {
final Module additionalModule = data.myModuleFixtureBuilder.getFixture().getModule();
myAdditionalModules.add(additionalModule);
final AndroidFacet facet = addAndroidFacet(additionalModule, sdkPath, getPlatformDir());
facet.setLibraryProject(data.myLibrary);
final String rootPath = getContentRootPath(data.myDirName);
myFixture.copyDirectoryToProject("res", rootPath + "/res");
myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML,
rootPath + '/' + SdkConstants.FN_ANDROID_MANIFEST_XML);
ModuleRootModificationUtil.addDependency(myModule, additionalModule);
}
if (!myCreateManifest) {
deleteManifest();
}
if (RenderSecurityManager.RESTRICT_READS) {
// Unit test class loader includes disk directories which security manager does not allow access to
RenderSecurityManager.sEnabled = false;
}
ArrayList<String> allowedRoots = new ArrayList<String>();
collectAllowedRoots(allowedRoots);
registerAllowedRoots(allowedRoots, myTestRootDisposable);
}