View | Details | Raw Unified | Return to bug 110956
Collapse All | Expand All

(-)ui/org/eclipse/jdt/ui/tests/quickfix/AssistQuickFixTest.java (-58 / +53 lines)
Lines 4214-4225 Link Here
4214
		expected1.append("        int y = 1;\n");
4214
		expected1.append("        int y = 1;\n");
4215
		expected1.append("        switch (y) {\n");
4215
		expected1.append("        switch (y) {\n");
4216
		expected1.append("        case 1:\n");
4216
		expected1.append("        case 1:\n");
4217
		
4217
		expected1.append("            final int e4 = 9;\n");
4218
		expected1.append("            final int e4 = 9, e5 = 0;\n");
4218
		expected1.append("                int e5 = 0;\n");
4219
//		not as expected because of bug 109963
4220
//		expected1.append("            final int e4 = 9;\n");
4221
//		expected1.append("                int e5 = 0;\n");
4222
		
4223
		expected1.append("            Runnable runnable = new Runnable() {\n");
4219
		expected1.append("            Runnable runnable = new Runnable() {\n");
4224
		expected1.append("                    public void run() {\n");
4220
		expected1.append("                    public void run() {\n");
4225
		expected1.append("                        System.out.println(e4);\n");
4221
		expected1.append("                        System.out.println(e4);\n");
Lines 4233-4290 Link Here
4233
		assertExpectedExistInProposals(proposals, new String[] {expected1.toString()});	
4229
		assertExpectedExistInProposals(proposals, new String[] {expected1.toString()});	
4234
	}
4230
	}
4235
	
4231
	
4236
//Fails because of bug 109963
4232
	public void testSurroundWithRunnable26() throws Exception {
4237
//	public void testSurroundWithRunnable26() throws Exception {
4233
		
4238
//		
4234
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
4239
//		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
4235
		StringBuffer buf= new StringBuffer();
4240
//		StringBuffer buf= new StringBuffer();
4236
		buf.append("package test1;\n");
4241
//		buf.append("package test1;\n");
4237
		buf.append("public class E {\n");
4242
//		buf.append("public class E {\n");
4238
		buf.append("    public void foo() {\n");
4243
//		buf.append("    public void foo() {\n");
4239
		buf.append("        int y = 1;\n");
4244
//		buf.append("        int y = 1;\n");
4240
		buf.append("        switch (y) {\n");
4245
//		buf.append("        switch (y) {\n");
4241
		buf.append("        case 1:\n");
4246
//		buf.append("        case 1:\n");
4242
		buf.append("            int e4 = 9, e5 = 0;\n");
4247
//		buf.append("            int e4 = 9, e5 = 0;\n");
4243
		buf.append("            System.out.println(e4);\n");
4248
//		buf.append("            System.out.println(e4);\n");
4244
		buf.append("            e5++;\n");
4249
//		buf.append("            e5++;\n");
4245
		buf.append("        default:\n");
4250
//		buf.append("        default:\n");
4246
		buf.append("        }\n");
4251
//		buf.append("        }\n");
4247
		buf.append("    }\n");
4252
//		buf.append("    }\n");
4248
		buf.append("}\n");
4253
//		buf.append("}\n");
4249
		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
4254
//		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
4250
		
4255
//		
4251
		StringBuffer selection= new StringBuffer();
4256
//		StringBuffer selection= new StringBuffer();
4252
		selection.append("            int e4 = 9, e5 = 0;\n");
4257
//		selection.append("            int e4 = 9, e5 = 0;\n");
4253
		selection.append("            System.out.println(e4);\n");
4258
//		selection.append("            System.out.println(e4);\n");
4254
		
4259
//		
4255
		AssistContext context= getCorrectionContext(cu, buf.toString().indexOf(selection.toString()), selection.toString().length());
4260
//		AssistContext context= getCorrectionContext(cu, buf.toString().indexOf(selection.toString()), selection.toString().length());
4256
		List proposals= collectAssists(context, false);
4261
//		List proposals= collectAssists(context, false);
4257
		
4262
//		
4258
		assertNumberOfProposals(proposals, 9);
4263
//		assertNumberOfProposals(proposals, 9);
4259
		assertCorrectLabels(proposals);
4264
//		assertCorrectLabels(proposals);
4260
4265
//
4261
		StringBuffer expected1= new StringBuffer();
4266
//		StringBuffer expected1= new StringBuffer();
4262
		expected1.append("package test1;\n");
4267
//		expected1.append("package test1;\n");
4263
		expected1.append("public class E {\n");
4268
//		expected1.append("public class E {\n");
4264
		expected1.append("    public void foo() {\n");
4269
//		expected1.append("    public void foo() {\n");
4265
		expected1.append("        int y = 1;\n");
4270
//		expected1.append("        int y = 1;\n");
4266
		expected1.append("        switch (y) {\n");
4271
//		expected1.append("        switch (y) {\n");
4267
		expected1.append("        case 1:\n");
4272
//		expected1.append("        case 1:\n");
4268
		expected1.append("            int e5;\n");
4273
//		expected1.append("            int e5;\n");
4269
		expected1.append("                Runnable runnable = new Runnable() {\n");
4274
//		expected1.append("                Runnable runnable = new Runnable() {\n");
4270
		expected1.append("                    public void run() {\n");
4275
//		expected1.append("                    public void run() {\n");
4271
		expected1.append("                        int e4 = 9;\n");
4276
//		expected1.append("                        int e4 = 9;\n");
4272
		expected1.append("                        e5 = 0;\n");
4277
//		expected1.append("                        e5 = 0;\n");
4273
		expected1.append("                        System.out.println(e4);\n");
4278
//		expected1.append("                        System.out.println(e4);\n");
4274
		expected1.append("                    }\n");
4279
//		expected1.append("                    }\n");
4275
		expected1.append("                };\n");
4280
//		expected1.append("                };\n");
4276
		expected1.append("                e5++;\n");
4281
//		expected1.append("                e5++;\n");
4277
		expected1.append("        default:\n");
4282
//		expected1.append("        default:\n");
4278
		expected1.append("        }\n");
4283
//		expected1.append("        }\n");
4279
		expected1.append("    }\n");
4284
//		expected1.append("    }\n");
4280
		expected1.append("}\n");
4285
//		expected1.append("}\n");
4281
		assertExpectedExistInProposals(proposals, new String[] {expected1.toString()});	
4286
//		assertExpectedExistInProposals(proposals, new String[] {expected1.toString()});	
4282
	}
4287
//	}
4288
	
4283
	
4289
	public void testSurroundWithRunnable27() throws Exception {
4284
	public void testSurroundWithRunnable27() throws Exception {
4290
		
4285
		

Return to bug 110956