assertEquals("To", ht.peek().getValue()); assertEquals("To", ht.next().getValue()); assertEquals(":", ht.peek().getValue()); assertEquals(":", ht.next().getValue()); t = ht.next(); assertEquals("Geronimo List", t.getValue()); assertEquals(Token.QUOTEDSTRING, t.getType()); assertEquals("<", ht.next().getValue()); assertEquals("geronimo-dev", ht.next().getValue()); assertEquals("@", ht.next().getValue()); assertEquals("apache", ht.next().getValue()); assertEquals(".", ht.next().getValue()); assertEquals("org", ht.next().getValue()); assertEquals(">", ht.next().getValue()); assertEquals(",", ht.next().getValue()); assertEquals("Geronimo", ht.next().getValue()); assertEquals("User", ht.next().getValue()); assertEquals("<", ht.next().getValue()); assertEquals("geronimo-user", ht.next().getValue()); assertEquals("@", ht.next().getValue()); assertEquals("apache", ht.next().getValue()); assertEquals(".", ht.next().getValue());
validateToken(ht.peek(), Token.ATOM, "To"); validateToken(ht.next(), Token.ATOM, "To"); validateToken(ht.peek(), ':', ":"); validateToken(ht.next(), ':', ":"); validateToken(ht.next(), Token.QUOTEDSTRING, "Geronimo List"); validateToken(ht.next(), '<', "<"); validateToken(ht.next(), Token.ATOM, "geronimo-dev"); validateToken(ht.next(), '@', "@"); validateToken(ht.next(), Token.ATOM, "apache"); validateToken(ht.next(), '.', "."); validateToken(ht.next(), Token.ATOM, "org"); validateToken(ht.next(), '>', ">"); validateToken(ht.next(), ',', ","); validateToken(ht.next(), Token.ATOM, "Geronimo"); validateToken(ht.next(), Token.ATOM, "User"); validateToken(ht.next(), '<', "<"); validateToken(ht.next(), Token.ATOM, "geronimo-user"); validateToken(ht.next(), '@', "@"); validateToken(ht.next(), Token.ATOM, "apache"); validateToken(ht.next(), '.', ".");
    public void testTokenizer() throws ParseException {        Token t;        HeaderTokenizer ht;        ht =            new HeaderTokenizer("To: \"Geronimo List\" <geronimo-dev@apache.org>, \n\r Geronimo User <geronimo-user@apache.org>");        assertEquals("To", ht.peek().getValue());        assertEquals("To", ht.next().getValue());        assertEquals(":", ht.peek().getValue());        assertEquals(":", ht.next().getValue());        t = ht.next();        assertEquals("Geronimo List", t.getValue());        assertEquals(Token.QUOTEDSTRING, t.getType());        assertEquals("<", ht.next().getValue());        assertEquals("geronimo-dev", ht.next().getValue());        assertEquals("@", ht.next().getValue());        assertEquals("apache", ht.next().getValue());        assertEquals(".", ht.next().getValue());        assertEquals("org", ht.next().getValue());        assertEquals(">", ht.next().getValue());        assertEquals(",", ht.next().getValue());        assertEquals("Geronimo", ht.next().getValue());        assertEquals("User", ht.next().getValue());        assertEquals("<", ht.next().getValue());        assertEquals("geronimo-user", ht.next().getValue());        assertEquals("@", ht.next().getValue());        assertEquals("apache", ht.next().getValue());        assertEquals(".", ht.next().getValue());        assertEquals("org>", ht.getRemainder());        assertEquals("org", ht.peek().getValue());        assertEquals("org>", ht.getRemainder());        assertEquals("org", ht.next().getValue());        assertEquals(">", ht.next().getValue());        assertEquals(Token.EOF, ht.next().getType());        ht = new HeaderTokenizer("   ");        assertEquals(Token.EOF, ht.next().getType());        ht = new HeaderTokenizer("J2EE");        assertEquals("J2EE", ht.next().getValue());        assertEquals(Token.EOF, ht.next().getType());        // test comments        doComment(true);        doComment(false);    }