本文整理汇总了Java中com.intellij.testFramework.builders.JavaModuleFixtureBuilder类的典型用法代码示例。如果您正苦于以下问题:Java JavaModuleFixtureBuilder类的具体用法?Java JavaModuleFixtureBuilder怎么用?Java JavaModuleFixtureBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaModuleFixtureBuilder类属于com.intellij.testFramework.builders包,在下文中一共展示了JavaModuleFixtureBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@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();
}
示例2: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@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);
}
示例3: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
JavaTestFixtureFactory.getFixtureFactory(); // registers Java module fixture builder
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getClass().getSimpleName());
myFixture = fixtureFactory.createTempDirTestFixture();
myFixture.setUp();
FileUtil.copyDir(new File(PluginPathManager.getPluginHomePath("testng") + "/testData/runConfiguration/module1"),
new File(myFixture.getTempDirPath()), false);
myProjectFixture = testFixtureBuilder.getFixture();
final JavaModuleFixtureBuilder javaModuleFixtureBuilder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
javaModuleFixtureBuilder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src");
javaModuleFixtureBuilder.addLibrary("testng", PathUtil.getJarPathForClass(AfterMethod.class));
myProjectFixture.setUp();
}
示例4: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的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();
}
示例5: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@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.enableInspections(new SillyAssignmentInspection());
myFixture.setUp();
addAnnotationsModuleRoot();
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject());
myLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
}
示例6: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
JavaTestFixtureFactory.getFixtureFactory(); // registers Java module fixture builder
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder();
myFixture = fixtureFactory.createTempDirTestFixture();
myFixture.setUp();
FileUtil.copyDir(new File(PluginPathManager.getPluginHomePath("testng") + "/testData/runConfiguration/module1"),
new File(myFixture.getTempDirPath()), false);
myProjectFixture = testFixtureBuilder.getFixture();
final JavaModuleFixtureBuilder javaModuleFixtureBuilder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
javaModuleFixtureBuilder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src");
javaModuleFixtureBuilder.addLibrary("testng", PathUtil.getJarPathForClass(AfterMethod.class));
myProjectFixture.setUp();
}
示例7: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的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);
}
示例8: ModuleBuilder
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
public ModuleBuilder(@NotNull final TestFixtureBuilder<IdeaProjectTestFixture> host,
@NotNull final String name,
@NotNull final String[] path) throws Exception {
myHost = host;
final
JavaModuleFixtureBuilder bld = host.addModule(JavaModuleFixtureBuilder.class);
bld.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
bld.addSourceContentRoot(testDataPath(path));
myModule = bld.getFixture();
myModule.setUp();
new WriteAction<Void>() {
@Override
protected void run(Result<Void> result) throws Throwable {
final ModifiableModuleModel model = ModuleManager.getInstance(project()).getModifiableModel();
try {
model.renameModule(module(), name);
} catch (ModuleWithNameAlreadyExists moduleWithNameAlreadyExists) {
model.dispose();
Assert.fail();
return;
}
model.commit();
}
}.execute();
}
示例9: addLibrary
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@Override
public JavaModuleFixtureBuilder addLibrary(String libraryName, String... classPath) {
final HashMap<OrderRootType, String[]> map = new HashMap<OrderRootType, String[]>();
for (String path : classPath) {
if (!new File(path).exists()) {
System.out.println(path + " does not exist");
}
}
map.put(OrderRootType.CLASSES, classPath);
myLibraries.add(new Lib(libraryName, map));
return this;
}
示例10: addLibraryJars
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@Override
public JavaModuleFixtureBuilder addLibraryJars(String libraryName, String basePath, String... jars) {
if (!basePath.endsWith("/")) {
basePath += "/";
}
String[] classPath = ArrayUtil.newStringArray(jars.length);
for (int i = 0; i < jars.length; i++) {
classPath[i] = basePath + jars[i];
}
return addLibrary(libraryName, classPath);
}
示例11: tuneFixture
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@Override
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
moduleBuilder.setLanguageLevel(LanguageLevel.JDK_1_8);
moduleBuilder.addLibraryJars("guava-17.0.jar", PathManager.getHomePath().replace(File.separatorChar, '/') + "/community/lib/",
"guava-17.0.jar");
moduleBuilder.addLibraryJars("guava-17.0.jar-2", PathManager.getHomePath().replace(File.separatorChar, '/') + "/lib/",
"guava-17.0.jar");
moduleBuilder.addJdk(IdeaTestUtil.getMockJdk18Path().getPath());
}
示例12: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@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();
}
示例13: setUp
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
@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();
}
示例14: addModuleWithAndroidFacet
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的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));
}
示例15: tuneModule
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; //导入依赖的package包/类
public static void tuneModule(JavaModuleFixtureBuilder moduleBuilder, String moduleDirPath) {
moduleBuilder.addContentRoot(moduleDirPath);
//noinspection ResultOfMethodCallIgnored
new File(moduleDirPath + "/src/").mkdir();
moduleBuilder.addSourceRoot("src");
//noinspection ResultOfMethodCallIgnored
new File(moduleDirPath + "/gen/").mkdir();
moduleBuilder.addSourceRoot("gen");
}