Java源码示例:com.intellij.testFramework.LightProjectDescriptor
示例1
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
LanguageLevel languageLevel = LanguageLevel.JDK_1_8;
return new DefaultLightProjectDescriptor() {
@Override
public Sdk getSdk() {
String compilerOption = JpsJavaSdkType.complianceOption(languageLevel.toJavaVersion());
return JavaSdk.getInstance().createJdk( "java " + compilerOption, BUILD_MOCK_JDK_DIRECTORY + compilerOption, false );
}
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension( LanguageLevelModuleExtension.class ).setLanguageLevel( languageLevel );
}
};
}
示例2
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
LanguageLevel languageLevel = LanguageLevel.JDK_1_8;
return new DefaultLightProjectDescriptor() {
@Override
public Sdk getSdk() {
String compilerOption = JpsJavaSdkType.complianceOption(languageLevel.toJavaVersion());
return JavaSdk.getInstance().createJdk( "java " + compilerOption, BUILD_MOCK_JDK_DIRECTORY + compilerOption, false );
}
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension( LanguageLevelModuleExtension.class ).setLanguageLevel( languageLevel );
}
};
}
示例3
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new ProjectDescriptor(LanguageLevel.JDK_1_8, false) {
@Override
public Sdk getSdk() {
return JavaSdk.getInstance().createJdk("java 1.8", MOCK_JDK_HOME, false);
}
};
}
示例4
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new ProjectDescriptor(LanguageLevel.JDK_1_8, false) {
@Override
public Sdk getSdk() {
return JavaSdk.getInstance().createJdk("java 1.8", MOCK_JDK_HOME, false);
}
};
}
示例5
private SwaggerFixture(@NotNull String folderAbsolutePath) throws Exception {
IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
LightProjectDescriptor projectDescriptor = LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR;
TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder =
factory.createLightFixtureBuilder(projectDescriptor);
IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
myCodeInsightFixture =
factory.createCodeInsightFixture(fixture, new LightTempDirTestFixtureImpl(true));
myCodeInsightFixture.setUp();
myCodeInsightFixture.setTestDataPath(folderAbsolutePath);
}
示例6
/**
* Dumb fix for test failure:
* ./gradlew test --debug --tests *Test.testUnresolvedOptionReference_StandardOption
* --tests FindUsagesTest.testStandardOptionReferenceUsages
* When FindUsagesTest does not run first - it fails.
*/
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new LightProjectDescriptor() {
};
}
示例7
public static LightProjectDescriptor getProjectDescriptor() {
return new DefaultLightProjectDescriptor() {
@Override
public Sdk getSdk() {
return JavaSdk.getInstance().createJdk("java 1.8", "lib/mockJDK-1.8", false);
}
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_8);
}
};
}
示例8
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return LightJavaCodeInsightFixtureTestCase.JAVA_8;
}
示例9
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new NeosProjectDescriptor();
}
示例10
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return LombokTestUtil.getProjectDescriptor();
}
示例11
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return LombokTestUtil.getProjectDescriptor();
}