DerivationTree extends NimbleTree<Symbol> { public boolean buildDerivationTree(){ assert this.getCurrentNode() instanceof DerivationNode : this.getCurrentNode().getClass().getName(); DerivationNode t; Boolean validBuild; t = (DerivationNode)this.getCurrentNode(); this.grammy.findRule(t.getData()); validBuild = growNode(t); this.genny.setUsedGenes(this.geneCnt); return validBuild; } DerivationTree(GEGrammar gram, GEChromosome gen);  DerivationTree(DerivationTree copy); boolean buildDerivationTree(); int getWrapCount(); int getGeneCnt(); boolean derive();  }
@Test public void testBuildDerivationTree() { System.out.println("* DerivationTreeTest: buildDerivationTree"); boolean expResult = true; boolean result = dt.buildDerivationTree(); assertEquals(expResult, result); assertEquals(3, dt.getGeneCnt()); assertEquals(1, dt.getWrapCount()); dt = new DerivationTree(geg, chrom); dt.setCurrentNode(new TreeNode<Symbol>()); result = true; try { result = dt.buildDerivationTree(); } catch (AssertionError e) { assertTrue(true); } catch (ClassCastException e) { assertTrue(true); } assertEquals(true, result); geg.setMaxWraps(1); int[] ia = {0}; chrom.setAll(ia); dt = new DerivationTree(geg, chrom); result = true; result = dt.buildDerivationTree(); assertEquals(false, result); }