blob: a3b19bbd44a8071803bb25e15d16bc23655d8e28 [file] [log] [blame]
package org.eclipse.jdt.ui.tests.quickfix;
import java.util.ArrayList;
import java.util.Hashtable;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.IProblem;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.testplugin.JavaProjectHelper;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.text.correction.CUCorrectionProposal;
import org.eclipse.jdt.internal.ui.text.correction.CorrectionContext;
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor;
import org.eclipse.jdt.internal.ui.text.correction.NewCUCompletionUsingWizardProposal;
public class UnresolvedTypesQuickFixTest extends QuickFixTest {
private static final Class THIS= UnresolvedTypesQuickFixTest.class;
private IJavaProject fJProject1;
private IPackageFragmentRoot fSourceFolder;
public UnresolvedTypesQuickFixTest(String name) {
super(name);
}
public static Test suite() {
if (true) {
return new TestSuite(THIS);
} else {
TestSuite suite= new TestSuite();
suite.addTest(new UnresolvedTypesQuickFixTest("testPrimitiveTypeInFieldDecl"));
return suite;
}
}
protected void setUp() throws Exception {
Hashtable options= JavaCore.getDefaultOptions();
options.put(JavaCore.FORMATTER_TAB_CHAR, JavaCore.SPACE);
options.put(JavaCore.FORMATTER_TAB_SIZE, "4");
JavaCore.setOptions(options);
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.CODEGEN__FILE_COMMENTS, false);
store.setValue(PreferenceConstants.CODEGEN__JAVADOC_STUBS, false);
fJProject1= JavaProjectHelper.createJavaProject("TestProject1", "bin");
assertTrue("rt not found", JavaProjectHelper.addRTJar(fJProject1) != null);
fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
}
protected void tearDown() throws Exception {
JavaProjectHelper.delete(fJProject1);
}
public void testTypeInFieldDecl() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" Vector1 vec;\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 3);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("import java.util.Vector;\n");
buf.append("\n");
buf.append("public class E {\n");
buf.append(" Vector vec;\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(1);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("Vector1.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public class Vector1 {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(2);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
newCU= pack1.getCompilationUnit("Vector1.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public interface Vector1 {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testTypeInMethodDecl() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" void foo(Vect1or[] vec) {\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 3);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("import java.util.Vector;\n");
buf.append("\n");
buf.append("public class E {\n");
buf.append(" void foo(Vector[] vec) {\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(1);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("Vect1or.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public class Vect1or {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(2);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
newCU= pack1.getCompilationUnit("Vect1or.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public interface Vect1or {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testTypeInStatement() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.util.ArrayList;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" ArrayList v= new ArrayListist();\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 2);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.util.ArrayList;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" ArrayList v= new ArrayList();\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(1);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("ArrayListist.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("import java.util.ArrayList;\n");
buf.append("\n");
buf.append("public class ArrayListist extends ArrayList {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
}
public void testArrayTypeInStatement() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.io.*;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" Serializable[] v= new ArrayListExtra[10];\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 4);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.io.*;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" Serializable[] v= new Serializable[10];\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
proposal= (CUCorrectionProposal) proposals.get(1);
preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("import java.io.*;\n");
buf.append("import java.util.ArrayList;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" Serializable[] v= new ArrayList[10];\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(2);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("ArrayListExtra.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("import java.io.Serializable;\n");
buf.append("\n");
buf.append("public class ArrayListExtra implements Serializable {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(3);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
newCU= pack1.getCompilationUnit("ArrayListExtra.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("import java.io.Serializable;\n");
buf.append("\n");
buf.append("public interface ArrayListExtra extends Serializable {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testQualifiedType() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" test2.Test t= null;\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 2);
assertCorrectLabels(proposals);
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(0);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= fSourceFolder.getPackageFragment("test2").getCompilationUnit("Test.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test2;\n");
buf.append("\n");
buf.append("public class Test {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(1);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
newCU= fSourceFolder.getPackageFragment("test2").getCompilationUnit("Test.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test2;\n");
buf.append("\n");
buf.append("public interface Test {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testInnerType() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" Object object= new F.Inner();\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu1= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class F {\n");
buf.append("}\n");
ICompilationUnit cu2= pack1.createCompilationUnit("F.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu1, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu1, problems[0]);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 2);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" Object object= new Object();\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualString(preview, buf.toString());
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(1);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class F {\n");
buf.append(" public class Inner {\n");
buf.append("\n");
buf.append(" }\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(cu2.getSource(), buf.toString());
}
public void testTypeInCatchBlock() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" void foo() {\n");
buf.append(" try {\n");
buf.append(" } catch (XXX x) {\n");
buf.append(" }\n");
buf.append(" }\n");
buf.append("}\n");
ICompilationUnit cu1= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu1, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu1, problems[0]);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 1);
assertCorrectLabels(proposals);
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(0);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("XXX.java");
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public class XXX extends Exception {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testTypeInSuperType() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E extends XXX {\n");
buf.append("}\n");
ICompilationUnit cu1= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu1, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu1, problems[0]);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 1);
assertCorrectLabels(proposals);
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(0);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("XXX.java");
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public class XXX {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testTypeInSuperInterface() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public interface E extends XXX {\n");
buf.append("}\n");
ICompilationUnit cu1= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu1, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu1, problems[0]);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 1);
assertCorrectLabels(proposals);
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(0);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("XXX.java");
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public interface XXX {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
public void testPrimitiveTypeInFieldDecl() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
StringBuffer buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" floot vec= 1.0;\n");
buf.append("}\n");
ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
CompilationUnit astRoot= AST.parseCompilationUnit(cu, true);
IProblem[] problems= astRoot.getProblems();
assertNumberOf("problems", problems.length, 1);
CorrectionContext context= getCorrectionContext(cu, problems[0]);
assertCorrectContext(context);
ArrayList proposals= new ArrayList();
JavaCorrectionProcessor.collectCorrections(context, proposals);
assertNumberOf("proposals", proposals.size(), 5);
assertCorrectLabels(proposals);
CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
String preview1= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" double vec= 1.0;\n");
buf.append("}\n");
String expected1= buf.toString();
proposal= (CUCorrectionProposal) proposals.get(1);
String preview2= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" Float vec= 1.0;\n");
buf.append("}\n");
String expected2= buf.toString();
proposal= (CUCorrectionProposal) proposals.get(2);
String preview3= proposal.getCompilationUnitChange().getPreviewContent();
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("public class E {\n");
buf.append(" float vec= 1.0;\n");
buf.append("}\n");
String expected3= buf.toString();
assertEqualStringsIgnoreOrder(new String[] { preview1, preview2, preview3 }, new String[] { expected1, expected2, expected3 });
NewCUCompletionUsingWizardProposal newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(3);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
ICompilationUnit newCU= pack1.getCompilationUnit("floot.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public class floot {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
JavaProjectHelper.performDummySearch();
newCU.delete(true, null);
newCUWizard= (NewCUCompletionUsingWizardProposal) proposals.get(4);
newCUWizard.setShowDialog(false);
newCUWizard.apply(null);
newCU= pack1.getCompilationUnit("floot.java");
assertTrue("Nothing created", newCU.exists());
buf= new StringBuffer();
buf.append("package test1;\n");
buf.append("\n");
buf.append("public interface floot {\n");
buf.append("\n");
buf.append("}\n");
assertEqualStringIgnoreDelim(newCU.getSource(), buf.toString());
}
}