protected String getPreviewsInBufAppend(ICompilationUnit cu, List proposals) throws CoreException, BadLocationException { StringBuffer buf= new StringBuffer(); String[] previewContents= getPreviewContents(proposals);  buf.append("public void testX() throws Exception {\n"); buf.append("IPackageFragment pack1= fSourceFolder.createPackageFragment(\"").append(cu.getParent().getElementName()).append("\", false, null);\n"); buf.append("StringBuffer buf= new StringBuffer();\n"); wrapInBufAppend(cu.getBuffer().getContents(), buf); buf.append("ICompilationUnit cu= pack1.createCompilationUnit(\"").append(cu.getElementName()).append("\", buf.toString(), false, null);\n\n"); buf.append("CompilationUnit astRoot= getASTRoot(cu);\n"); buf.append("ArrayList proposals= collectCorrections(cu, astRoot);\n\n"); buf.append("assertCorrectLabels(proposals);\n");  buf.append("assertNumberOfProposals(proposals, ").append(previewContents.length).append(");\n\n"); buf.append("String[] expected= new String[").append(previewContents.length).append("];\n");  for (int i= 0; i < previewContents.length; i++) { String curr= previewContents[i]; if (curr == null) { continue; }  buf.append("buf= new StringBuffer();\n"); wrapInBufAppend(curr, buf); buf.append("expected[" + i + "]= buf.toString();\n\n");
public static String getPreviewsInBufAppend(ICompilationUnit cu) throws CoreException, BadLocationException { CompilationUnit astRoot= getASTRoot(cu); List proposals= collectCorrections(cu, astRoot); if (proposals.isEmpty()) { return null;
	protected String getPreviewsInBufAppend(ICompilationUnit cu, List proposals) throws CoreException, BadLocationException {		StringBuffer buf= new StringBuffer();		String[] previewContents= getPreviewContents(proposals);				buf.append("public void testX() throws Exception {\n");		buf.append("IPackageFragment pack1= fSourceFolder.createPackageFragment(\"").append(cu.getParent().getElementName()).append("\", false, null);\n");		buf.append("StringBuffer buf= new StringBuffer();\n");		wrapInBufAppend(cu.getBuffer().getContents(), buf);		buf.append("ICompilationUnit cu= pack1.createCompilationUnit(\"").append(cu.getElementName()).append("\", buf.toString(), false, null);\n\n");		buf.append("CompilationUnit astRoot= getASTRoot(cu);\n");		buf.append("ArrayList proposals= collectCorrections(cu, astRoot);\n\n");		buf.append("assertCorrectLabels(proposals);\n");				buf.append("assertNumberOfProposals(proposals, ").append(previewContents.length).append(");\n\n");		buf.append("String[] expected= new String[").append(previewContents.length).append("];\n");				for (int i= 0; i < previewContents.length; i++) {			String curr= previewContents[i];			if (curr == null) {				continue;			}						buf.append("buf= new StringBuffer();\n");			wrapInBufAppend(curr, buf);			buf.append("expected[" + i + "]= buf.toString();\n\n");		}				buf.append("assertExpectedExistInProposals(proposals, expected);\n");		buf.append("}\n");		return buf.toString();	}