IDEA-169244 Evaluate expression inside of local class fails when anonymous class is used - fixed tests

This commit is contained in:
Egor.Ushakov
2017-04-10 13:34:14 +03:00
parent 46465ffbc6
commit 292bf4f85c
@@ -60,7 +60,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testSimpleGeneration() throws Exception {
doTest("int i = 0; int j = 0;", "Test test = new Test().invoke();int i = test.getI();int j = test.getJ();",
"public static class Test {\n" +
"static class Test {\n" +
" private int i;\n" +
" private int j;\n" +
"\n" +
@@ -83,7 +83,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testInvokeReturnType() throws Exception {
doTest("x = 6; y = 6;", "Test test = new Test().invoke();x = test.getX();y = test.getY();",
"public static class Test {\n" +
"static class Test {\n" +
" private int x;\n" +
" private int y;\n" +
"\n" +
@@ -106,8 +106,8 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testAnonymousClassParams() throws Exception {
doTest("new I() {public void foo(int i) {i++;}};", "I result = Test.invoke();",
"public static class Test {\n" +
" public static I invoke() {\n" +
"static class Test {\n" +
" static I invoke() {\n" +
" return new I() {\n" +
" public void foo(int i) {\n" +
" i++;\n" +
@@ -120,7 +120,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testInnerClass() throws Exception {
doTest(" new I(2).foo()", "new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public void invoke() {\n" +
" new Sample.I(2).foo();\n" +
" }\n" +
@@ -130,7 +130,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testResultExpr() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +
@@ -140,7 +140,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testResultStatements() throws Exception {
doTest("int i = 0;\nfoo()", "Test test = new Test().invoke();int i = test.getI();int result = test.getResult();",
"public class Test {\n" +
"class Test {\n" +
" private int i;\n" +
" private int result;\n" +
"\n" +
@@ -164,7 +164,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOffsetsAtCallSite() throws Exception {
doTest("map.entrySet().stream().filter((a) -> (a.getKey()>0));",
"Stream<Map.Entry<Integer,Integer>> result = new Test(map).invoke();",
"public static class Test {\n" +
"static class Test {\n" +
" private Map<Integer, Integer> map;\n" +
"\n" +
" public Test(Map<Integer, Integer> map) {\n" +
@@ -178,8 +178,8 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
}
public void testHangingFunctionalExpressions() throws Exception {
doTest("() -> {}", "Test.invoke();", "public static class Test {\n" +
" public static void invoke() {\n" +
doTest("() -> {}", "Test.invoke();", "static class Test {\n" +
" static void invoke() {\n" +
" () -> {\n" +
" };\n" +
" }\n" +
@@ -189,8 +189,8 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testArrayInitializer() throws Exception {
doTest("{new Runnable() {public void run(){} } }",
"Runnable[] result = Test.invoke();",
"public static class Test {\n" +
" public static Runnable[] invoke() {\n" +
"static class Test {\n" +
" static Runnable[] invoke() {\n" +
" return new Runnable[]{new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
@@ -202,8 +202,8 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testNewArrayInitializer() throws Exception {
doTest("new Runnable[] {new Runnable() {public void run(){} } }",
"Runnable[] result = Test.invoke();",
"public static class Test {\n" +
" public static Runnable[] invoke() {\n" +
"static class Test {\n" +
" static Runnable[] invoke() {\n" +
" return new Runnable[]{new Runnable() {\n" +
" public void run() {\n" +
" }\n" +
@@ -227,7 +227,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
" foo();\n" +
" });",
"new Test(list).invoke();",
"public class Test {\n" +
"class Test {\n" +
" private List<Integer> list;\n" +
"\n" +
" public Test(List<Integer> list) {\n" +
@@ -256,7 +256,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnClosingBrace() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +
@@ -266,7 +266,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnClosingBraceLocalClass() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +
@@ -276,7 +276,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnFieldInitialization() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +
@@ -286,8 +286,8 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnEmptyMethod() throws Exception {
doTest(" foo()", "int result = Test.invoke();",
"public static class Test {\n" +
" public static int invoke() {\n" +
"static class Test {\n" +
" static int invoke() {\n" +
" return foo();\n" +
" }\n" +
" }");
@@ -296,7 +296,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnSuperConstructorCall() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +
@@ -306,7 +306,7 @@ public class ExtractMethodObject4DebuggerTest extends LightRefactoringTestCase {
public void testOnPrivateField() throws Exception {
doTest(" foo()", "int result = new Test().invoke();",
"public class Test {\n" +
"class Test {\n" +
" public int invoke() {\n" +
" return foo();\n" +
" }\n" +