diff --git a/java/java-tests/testData/refactoring/extractMethodObject4Debugger/NewArrayInitializer.java b/java/java-tests/testData/refactoring/extractMethodObject4Debugger/NewArrayInitializer.java new file mode 100644 index 000000000000..7b06937ca488 --- /dev/null +++ b/java/java-tests/testData/refactoring/extractMethodObject4Debugger/NewArrayInitializer.java @@ -0,0 +1,5 @@ +class Sample { + void foo() { + Runnable[] runs = {}; + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObject4DebuggerTest.java b/java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObject4DebuggerTest.java index 88873cd24425..af1fee9363dc 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObject4DebuggerTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/ExtractMethodObject4DebuggerTest.java @@ -201,6 +201,19 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase { " }", false); } + public void testNewArrayInitializer() throws Exception { + doTest("new Runnable[] {new Runnable() {public void run(){} } }", + "Runnable[] result = new Test().invoke();", + "public class Test {\n" + + " public Runnable[] invoke() {\n" + + " return new Runnable[]{new Runnable() {\n" + + " public void run() {\n" + + " }\n" + + " }};\n" + + " }\n" + + " }", false); + } + @Override protected Sdk getProjectJDK() { return IdeaTestUtil.getMockJdk18();