From e74edb2614dcc1590effa6e99bb6317675861877 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Sat, 18 Oct 2014 09:34:44 +0200 Subject: [PATCH] testdata for light extract method --- .../NewArrayInitializer.java | 5 +++++ .../ExtractMethodObject4DebuggerTest.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 java/java-tests/testData/refactoring/extractMethodObject4Debugger/NewArrayInitializer.java 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();