StandaloneExp extends Exp { public void insertAfter(CtBehavior behavior) throws CannotCompileException { if (isEmpty()) { return; } if (LOGGER.isTraceEnabled()) { LOGGER.trace("insert after " + behavior.getLongName() + ": " + this); } behavior.insertAfter(getInsertCode(getCode())); }  StandaloneExp append(StandaloneExp other); StandaloneExp append(NestedExp other); @Override abstract String getCode(); void insertBefore(CtBehavior behavior); void insertAfter(CtBehavior behavior); void insertCatch(CtClass exceptionType, CtBehavior behavior); void insertFinally(CtBehavior behavior); void replace(Expr expression); boolean isEmpty(); static final StandaloneExp PROCEED_AND_ASSIGN; }
@Test public void testInsertAfter() throws Exception { CtBehavior behavior = mock(CtBehavior.class); StandaloneExp exp = new IfExp(BooleanExp.TRUE); exp.insertAfter(behavior); verify(behavior).insertAfter("{ \nif (true) {\n} }"); }