Lines 268-273
Link Here
|
268 |
buf.append("}\n"); |
268 |
buf.append("}\n"); |
269 |
assertEqualString(cu.getSource(), buf.toString()); |
269 |
assertEqualString(cu.getSource(), buf.toString()); |
270 |
} |
270 |
} |
|
|
271 |
|
272 |
public void testAddImports4() throws Exception { |
273 |
getJavaProject("P").setOption(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, JavaCore.INSERT); |
274 |
|
275 |
IPackageFragment pack1= this.sourceFolder.createPackageFragment("pack1", false, null); |
276 |
StringBuffer buf= new StringBuffer(); |
277 |
buf.append("package pack1;\n"); |
278 |
buf.append("\n"); |
279 |
buf.append("import java.util.Set; // comment\n"); |
280 |
buf.append("\n"); |
281 |
buf.append("public class C {\n"); |
282 |
buf.append("}\n"); |
283 |
ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null); |
284 |
|
285 |
String[] order= new String[] { "java", "java.util", "com", "pack" }; |
286 |
|
287 |
ImportRewrite imports= newImportsRewrite(cu, order, 99, 99, true); |
288 |
imports.addImport("java.util.Vector"); |
289 |
|
290 |
apply(imports); |
291 |
|
292 |
buf= new StringBuffer(); |
293 |
buf.append("package pack1;\n"); |
294 |
buf.append("\n"); |
295 |
buf.append("import java.util.Set; // comment\n"); |
296 |
buf.append("import java.util.Vector ;\n"); |
297 |
buf.append("\n"); |
298 |
buf.append("public class C {\n"); |
299 |
buf.append("}\n"); |
300 |
assertEqualString(cu.getSource(), buf.toString()); |
301 |
} |
271 |
|
302 |
|
272 |
public void testAddImportsWithGroupsOfUnmatched1() throws Exception { |
303 |
public void testAddImportsWithGroupsOfUnmatched1() throws Exception { |
273 |
|
304 |
|