Rule extends ArrayList<Production> { public void setLHS(Symbol s) { assert (s.getType() == Enums.SymbolType.NTSymbol) : "Bad type: "+s.getType(); if(s.getType() == Enums.SymbolType.NTSymbol) { this.lhs = s; } } 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 testSetLHS() { System.out.println("* RuleTest: setLHS"); Symbol s = new Symbol("testT", Enums.SymbolType.TSymbol); Rule instance = new Rule(); try { instance.setLHS(s); } catch (AssertionError e) { assertTrue(true); } assertEquals(null, instance.getLHS()); s = new Symbol("testT", Enums.SymbolType.NTSymbol); instance.setLHS(s); assertEquals(true, s == instance.getLHS()); Symbol s1 = new Symbol("testT", Enums.SymbolType.NTSymbol); assertEquals(true, s1.equals(instance.getLHS())); }