### Question:
Token extends Symbol { public String asString() { return text != null ? text.toString() : data == null ? "" : data.toString(); } 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 testAsString() { Reduction reduction = new Reduction(); Token token = new Token(); token.setData(null); assertEquals("wrong text", "", token.asString()); token.setData(new Token()); assertEquals("wrong text", "<not initialized>", token.asString()); token.setData(reduction); assertEquals("wrong text", "[]", token.asString()); }