Phenotype extends ArrayList<Symbol> { public String getString() { Symbol currentSymbol; StringBuilder S = new StringBuilder(); for (Object o : this) { currentSymbol = (Symbol)o; S.append(currentSymbol.getSymbolString()); S.append(" "); } return S.toString(); } Phenotype();  Phenotype(Phenotype p); String getString(); String getStringNoSpace(); @Override String toString();  }
@Test public void testGetString() { System.out.println("PhenotypeTest: getString"); Phenotype instance = new Phenotype(); String expResult = ""; String result = instance.getString(); assertEquals(expResult, result); instance = new Phenotype(); instance.add(new Symbol("a",Enums.SymbolType.TSymbol)); instance.add(new Symbol("b", Enums.SymbolType.TSymbol)); result = "a b "; expResult = instance.getString(); assertEquals(true, result.equals(expResult)); instance = new Phenotype(); instance.add(new Symbol("a",Enums.SymbolType.TSymbol)); instance.add(new Symbol("", Enums.SymbolType.TSymbol)); instance.add(new Symbol("b", Enums.SymbolType.TSymbol)); result = "a b "; assertEquals(true, instance.getString().equals(result)); }