Rule extends ArrayList<Production> { @Override public String toString() { StringBuilder s = new StringBuilder(); s.append(lhs.getSymbolString()); s.append("::="); for(int i=0;i<this.size();i++) { s.append(this.get(i)); if(i<(this.size()-1)) { s.append("|"); } } return s.toString(); } Rule(int newLength);  Rule();  Rule(Rule copy); boolean getRecursive(); void setRecursive(boolean newRecursive); int getMinimumDepth(); void setMinimumDepth(int newMinimumDepth); void setLHS(Symbol s); Symbol getLHS(); @Override String toString();  }
@Test public void testToString() { System.out.println("* RuleTest: toString"); Rule instance = r; String expResult = "lhs::=testTtestNT|"; String result = instance.toString(); assertEquals(result, true, expResult.equals(result)); }