BlockStmt extends Stmt { public void insertStmt(int index, Stmt stmt) { stmts.add(index, stmt); } BlockStmt(List<Stmt> stmts, boolean introducesNewScope); List<Stmt> getStmts(); void setStmts(List<Stmt> stmts); int getNumStmts(); Stmt getLastStmt(); boolean introducesNewScope(); void setIntroducesNewScope(boolean introducesNewScope); void insertStmt(int index, Stmt stmt); void setStmt(int index, Stmt stmt); Stmt getStmt(int index); void removeStmt(int index); void removeStmt(Stmt child); @Override void accept(IAstVisitor visitor); @Override void replaceChild(IAstNode child, IAstNode newChild); @Override boolean hasChild(IAstNode candidateChild); void insertAfter(Stmt originalStmt, Stmt insertedStmt); void insertBefore(Stmt originalStmt, Stmt insertedStmt); void addStmt(Stmt stmt); @Override BlockStmt clone();  }
@Test public void testInsertStmt() { BlockStmt b = new BlockStmt(Arrays.asList(new NullStmt()), true); assertEquals(1, b.getNumStmts()); b.insertStmt(0, new ExprStmt(new BoolConstantExpr(true))); assertEquals(2, b.getNumStmts()); assertTrue(((BoolConstantExpr) ((ExprStmt)b.getStmt(0)).getExpr()).getIsTrue()); assertTrue(b.getStmt(1) instanceof NullStmt); }