### Question:
WKTTokenizer { public int nextToken() throws IOException { if (mPushBack) { mPushBack = false; return ttype; } read(); return ttype; } WKTTokenizer(Reader reader);  WKTTokenizer(String s); int nextToken(); void pushBack(); int lineno(); void resetSyntax(); void wordChars(char c, char d); void wordChars(int i, int j); void whitespaceChars(int i, char c); void commentChar(char c); public int ttype; static final int TT_EOF; static final int TT_EOL; static final int TT_NUMBER; static final int TT_WORD; public String sval; }### Answer:
@Test public void itShouldIgnoreComments() throws IOException { String s = "#P \n #( \r , \r\n# ,"; WKTTokenizer wktt = new WKTTokenizer(s); wktt.nextToken(); assertEquals("#", wktt.sval); wktt.nextToken(); assertEquals("(", wktt.sval); wktt.nextToken(); assertEquals(",", wktt.sval); assertEquals(-1, wktt.nextToken()); }
@Test public void itShouldReadWords() throws IOException { String s = "one two tree four"; WKTTokenizer wktt = new WKTTokenizer(s); wktt.nextToken(); assertEquals("one", wktt.sval); wktt.nextToken(); assertEquals("two", wktt.sval); wktt.nextToken(); assertEquals("tree", wktt.sval); wktt.nextToken(); assertEquals("four", wktt.sval); assertEquals(-1, wktt.nextToken()); }
@Test public void itShouldTokenizePolygon() throws IOException { String s = "POLYGON ((10 10, 10 20))"; WKTTokenizer wktt = new WKTTokenizer(s); wktt.nextToken(); assertEquals("POLYGON", wktt.sval); wktt.nextToken(); assertEquals("(", wktt.sval); wktt.nextToken(); assertEquals("(", wktt.sval); wktt.nextToken(); assertEquals("10", wktt.sval); wktt.nextToken(); assertEquals("10", wktt.sval); wktt.nextToken(); assertEquals(",", wktt.sval); wktt.nextToken(); assertEquals("10", wktt.sval); wktt.nextToken(); assertEquals("20", wktt.sval); wktt.nextToken(); assertEquals(")", wktt.sval); wktt.nextToken(); assertEquals(")", wktt.sval); assertEquals(-1, wktt.nextToken()); }