ASTNode placeHolder2= rewrite.createPlaceholder(buf1.toString(), ASTRewrite.STATEMENT);
ASTNode placeHolder2= rewrite.createPlaceholder(buf1.toString(), NewASTRewrite.STATEMENT);
	public void testInsertCode() 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("    public void foo() {\n");		buf.append("        while (i == j) {\n");		buf.append("            System.beep();\n");		buf.append("        }\n");				buf.append("    }\n");		buf.append("}\n");			ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);				CompilationUnit astRoot= AST.parseCompilationUnit(cu, false);		ASTRewrite rewrite= new ASTRewrite(astRoot);					assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);		TypeDeclaration type= findTypeDeclaration(astRoot, "E");		MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");		Block block= methodDecl.getBody();		List statements= block.statements();		assertTrue("Number of statements not 1", statements.size() == 1);		{ // replace while statement with comment, insert new statement			WhileStatement whileStatement= (WhileStatement) statements.get(0);			String comment= "//hello";			ASTNode placeHolder= rewrite.createPlaceholder(comment, ASTRewrite.STATEMENT);						rewrite.markAsReplaced(whileStatement, placeHolder);						StringBuffer buf1= new StringBuffer();			buf1.append("if (i == 3) {\n");			buf1.append("    System.beep();\n");			buf1.append("}");						ASTNode placeHolder2= rewrite.createPlaceholder(buf1.toString(), ASTRewrite.STATEMENT);			rewrite.markAsInserted(placeHolder2);						statements.add(placeHolder2);		}						ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal("", cu, rewrite, 10, null);		proposal.getCompilationUnitChange().setSave(true);				proposal.apply(null);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    public void foo() {\n");		buf.append("        //hello\n");		buf.append("        if (i == 3) {\n");		buf.append("            System.beep();\n");		buf.append("        }\n");				buf.append("    }\n");		buf.append("}\n");			assertEqualString(cu.getSource(), buf.toString());		clearRewrite(rewrite);	}