rewrite.markAsRemoved((ASTNode) parameters.get(0)); rewrite.markAsRemoved((ASTNode) parameters.get(1)); rewrite.markAsRemoved((ASTNode) parameters.get(2));
rewrite.markAsRemoved((ASTNode) parameters.get(0), null); rewrite.markAsRemoved((ASTNode) parameters.get(1), null); rewrite.markAsRemoved((ASTNode) parameters.get(2), null);
	public void testListCombinations() throws Exception {		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);		StringBuffer buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public abstract class E {\n");		buf.append("    public E(int p1, int p2, int p3) {}\n");		buf.append("    public void gee(int p1, int p2, int p3) throws IllegalArgumentException {}\n");		buf.append("    public void hee(int p1, int p2, int p3) throws IllegalArgumentException {}\n");		buf.append("    public void iee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException {}\n");		buf.append("    public void jee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException {}\n");		buf.append("    public abstract void kee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException, SecurityException;\n");		buf.append("    public abstract void lee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException, SecurityException;\n");		buf.append("}\n");			ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);					CompilationUnit astRoot= createAST(cu);		NewASTRewrite rewrite= new NewASTRewrite(astRoot.getAST());		AST ast= astRoot.getAST();		TypeDeclaration type= findTypeDeclaration(astRoot, "E");				{ // delete all and insert after & insert 2 exceptions			MethodDeclaration methodDecl= findMethodDeclaration(type, "E");			List parameters= methodDecl.parameters();			assertTrue("must be 3 parameters", parameters.size() == 3);					rewrite.markAsRemoved((ASTNode) parameters.get(0));			rewrite.markAsRemoved((ASTNode) parameters.get(1));			rewrite.markAsRemoved((ASTNode) parameters.get(2));			SingleVariableDeclaration newParam= createNewParam(ast, "m");			rewrite.getListRewrite(methodDecl, MethodDeclaration.PARAMETERS_PROPERTY).insertLast(newParam, null);			List thrownExceptions= methodDecl.thrownExceptions();			assertTrue("must be 0 thrown exceptions", thrownExceptions.size() == 0);						Name newThrownException1= ast.newSimpleName("InterruptedException");			rewrite.getListRewrite(methodDecl, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY).insertLast(newThrownException1, null);			Name newThrownException2= ast.newSimpleName("ArrayStoreException");			rewrite.getListRewrite(methodDecl, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY).insertLast(newThrownException2, null);					}		{ // delete first 2, replace last and insert after & replace first exception and insert before			MethodDeclaration methodDecl= findMethodDeclaration(type, "gee");			List parameters= methodDecl.parameters();			assertTrue("must be 3 parameters", parameters.size() == 3);			rewrite.markAsRemoved((ASTNode) parameters.get(0));			rewrite.markAsRemoved((ASTNode) parameters.get(1));						SingleVariableDeclaration newParam1= createNewParam(ast, "m1");			rewrite.markAsReplaced((ASTNode) parameters.get(2), newParam1);									SingleVariableDeclaration newParam2= createNewParam(ast, "m2");			rewrite.getListRewrite(methodDecl, MethodDeclaration.PARAMETERS_PROPERTY).insertLast(newParam2, null);			List thrownExceptions= methodDecl.thrownExceptions();			assertTrue("must be 1 thrown exceptions", thrownExceptions.size() == 1);						Name modifiedThrownException= ast.newSimpleName("InterruptedException");			rewrite.markAsReplaced((ASTNode) thrownExceptions.get(0), modifiedThrownException);									Name newThrownException2= ast.newSimpleName("ArrayStoreException");			rewrite.getListRewrite(methodDecl, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY).insertLast(newThrownException2, null);		}				{ // delete first 2, replace last and insert at first & remove first and insert before			MethodDeclaration methodDecl= findMethodDeclaration(type, "hee");			List parameters= methodDecl.parameters();			assertTrue("must be 3 parameters", parameters.size() == 3);			rewrite.markAsRemoved((ASTNode) parameters.get(0));			rewrite.markAsRemoved((ASTNode) parameters.get(1));						SingleVariableDeclaration newParam1= createNewParam(ast, "m1");			rewrite.markAsReplaced((ASTNode) parameters.get(2), newParam1);									SingleVariableDeclaration newParam2= createNewParam(ast, "m2");			rewrite.getListRewrite(methodDecl, MethodDeclaration.PARAMETERS_PROPERTY).insertFirst(newParam2, null);			List thrownExceptions= methodDecl.thrownExceptions();			assertTrue("must be 1 thrown exceptions", thrownExceptions.size() == 1);						rewrite.markAsRemoved((ASTNode) thrownExceptions.get(0));									Name newThrownException2= ast.newSimpleName("ArrayStoreException");			rewrite.getListRewrite(methodDecl, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY).insertLast(newThrownException2, null);		}						String preview= evaluateRewrite(cu, rewrite);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public abstract class E {\n");		buf.append("    public E(float m) throws InterruptedException, ArrayStoreException {}\n");		buf.append("    public void gee(float m1, float m2) throws InterruptedException, ArrayStoreException {}\n");		buf.append("    public void hee(float m2, float m1) throws ArrayStoreException {}\n");		buf.append("    public void iee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException {}\n");		buf.append("    public void jee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException {}\n");		buf.append("    public abstract void kee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException, SecurityException;\n");		buf.append("    public abstract void lee(int p1, int p2, int p3) throws IllegalArgumentException, IllegalAccessException, SecurityException;\n");		buf.append("}\n");						assertEqualString(preview, buf.toString());	}