### Question:
Token extends Symbol { public void appendData(String moreData) { if (text == null) { text = new StringBuilder(); } text.append(moreData); } Token();  Token(Object data);  Token(Symbol symbol, Object data);  Token(Symbol symbol, Object data, Position position); void appendData(String moreData); Reduction asReduction(); String asString(); int getState(); Object getData(); Position getPosition(); void setState(int state); void setData(Object data); void setPosition(Position position); void setSymbol(Symbol symbol);  }### Answer:
@Test public void testAppendData() { Token token = new Token(new Symbol(), "1234"); token.appendData(null); assertEquals("wrong text", "1234null", token.asString()); token = new Token(); token.appendData("1234"); assertEquals("wrong text", "1234", token.asString()); Reduction reduction = new Reduction(); token = new Token(); token.setData(reduction); token.appendData("ABC"); assertEquals("should have left reduction untouched", reduction, token.getData()); token = new Token(new Symbol(), "1234"); assertEquals("wrong text", "1234", token.asString()); token.appendData("5678"); assertEquals("wrong text", "12345678", token.asString()); }