Override/Implement: Add test to cover import optimization in the case of multiple import insertion (see #KT-4732)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package bar;
|
||||
|
||||
public interface Bar {
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package bar;
|
||||
|
||||
public interface Other {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package foo;
|
||||
|
||||
import bar.Bar;
|
||||
import bar.Other;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Foo {
|
||||
abstract public Bar foo(ArrayList<Integer> list, Other other);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package foo
|
||||
|
||||
class Impl: Foo() {
|
||||
<caret>
|
||||
}
|
||||
|
||||
// KT-4732 Override/Implement action does not add all imports when "Optimize imports on the fly" is enabled
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
import bar.Other
|
||||
import bar.Bar
|
||||
|
||||
class Impl: Foo() {
|
||||
|
||||
override fun foo(list: ArrayList<Int>?, other: Other?): Bar? {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
// KT-4732 Override/Implement action does not add all imports when "Optimize imports on the fly" is enabled
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.jet.plugin.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
public final class OverrideImplementTest extends AbstractOverrideImplementTest {
|
||||
@@ -146,6 +147,17 @@ public final class OverrideImplementTest extends AbstractOverrideImplementTest {
|
||||
doImplementDirectoryTest();
|
||||
}
|
||||
|
||||
public void testCheckNotImportedTypesFromJava() {
|
||||
boolean oldValue = CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY;
|
||||
try {
|
||||
CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = true;
|
||||
doImplementDirectoryTest();
|
||||
}
|
||||
finally {
|
||||
CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = oldValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void testOverrideSamAdapters() {
|
||||
doOverrideDirectoryTest("foo");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user