mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
self-contained AddImpotActionTest
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import java.util.Map;
|
||||
|
||||
// "Import Class" "true"
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
// "Import Class" "true"
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.intention;
|
||||
|
||||
|
||||
import com.intellij.pom.java.LanguageLevel
|
||||
import com.intellij.testFramework.IdeaTestUtil
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
|
||||
public class AddImportActionTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testMap15() {
|
||||
IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_1_5)
|
||||
myFixture.configureByText 'a.java', '''
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
'''
|
||||
myFixture.launchAction(myFixture.findSingleIntention("Import Class"))
|
||||
myFixture.checkResult '''import java.util.Map;
|
||||
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() {
|
||||
IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.HIGHEST)
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
public void testMapLatestLanguageLevel() {
|
||||
IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.HIGHEST)
|
||||
myFixture.configureByText 'a.java', '''
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
'''
|
||||
myFixture.launchAction(myFixture.findSingleIntention("Import Class"))
|
||||
myFixture.checkResult '''import java.util.Map;
|
||||
|
||||
public class Foo {
|
||||
void foo() {
|
||||
Ma<caret>p<> l;
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInsight.intention;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
|
||||
public class AddImportActionTest extends LightIntentionActionTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
final LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(getProject());
|
||||
|
||||
extension.setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
doAllTests();
|
||||
|
||||
extension.setLanguageLevel(LanguageLevel.HIGHEST);
|
||||
doAllTests();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/addImport";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user