TokenImpl implements Token { @Override public void append(char c) { if (!valueBuffer.hasRemaining()) enlarge(); valueBuffer.put(c); if (!containsNonSpace && c != ' ') containsNonSpace = true; } TokenImpl(Tokenizer tokenizer); TokenType getType(); boolean isFirst(); boolean isLast(); @Override void setLast(boolean value); int getIndex(); int getSubIndex(); @Override void setValue(char c); @Override char[] getValueChars(); @Override int getValueLength(); String getValue(); @Override boolean valueEquals(String v); @Override String getSegmentType(); @Override void setSegmentType(String s); @Override boolean containsNonSpace(); @Override String toString(); String getElementId(); @Override void resetIndexes(); @Override void resetSubElementIndex(); @Override void incrementIndex(); @Override void incrementSubElementIndex(); @Override void setType(TokenType tokenType); @Override void append(char c); @Override void resetValue();  }
@Test public void testAppend() { assertEquals(0, token.getIndex()); token.append('a'); assertEquals(0, token.getIndex()); assertEquals('a', token.getValueChars()[0]); assertEquals(1, token.getValueLength()); assertEquals("a", token.getValue()); token.append('b'); assertEquals(0, token.getIndex()); assertEquals('a', token.getValueChars()[0]); assertEquals('b', token.getValueChars()[1]); assertEquals(2, token.getValueLength()); assertEquals("ab", token.getValue()); }