IfExp extends StandaloneExp { public void addIfBody(StandaloneExp body) { if (ifBody == null) { ifBody = body; } else { ifBody = ifBody.append(body); } } IfExp(NestedExp condition); void addIfBody(StandaloneExp body); void addElseBody(StandaloneExp body); @Override String getCode();  }
@Test public void testAddIfBody() { IfExp ifExp = new IfExp(BooleanExp.TRUE); ifExp.addIfBody(new IfExp(BooleanExp.TRUE)); assertEquals("\nif (true) {\nif (true) {\n}\n}", ifExp.getCode()); }