Override/Implement: Add test to cover import optimization in the case of multiple import insertion (see #KT-4732)

This commit is contained in:
Alexey Sedunov
2014-06-19 16:17:56 +04:00
parent 5be7eb8a5c
commit 6bc3772d29
6 changed files with 52 additions and 0 deletions
@@ -0,0 +1,5 @@
package bar;
public interface Bar {
}
@@ -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
@@ -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");
}