String s =
"name = value; test; test1 = stuff,with,commas ; test2 = \"stuff; stuff\"; test3=\"stuff";
CharArrayBuffer buffer = new CharArrayBuffer(16);
buffer.append(s);
ParserCursor cursor = new ParserCursor(0, s.length());
HeaderElement he = parser.parseHeader(buffer, cursor);
assertEquals("name", he.getName());
assertEquals("value", he.getValue());
NameValuePair[] params = he.getParameters();
assertEquals("test", params[0].getName());
assertEquals(null, params[0].getValue());
assertEquals("test1", params[1].getName());
assertEquals("stuff,with,commas", params[1].getValue());
assertEquals("test2", params[2].getName());
assertEquals("stuff; stuff", params[2].getValue());
assertEquals("test3", params[3].getName());
assertEquals("\"stuff", params[3].getValue());
assertEquals(s.length(), cursor.getPos());
assertTrue(cursor.atEnd());
s = " ";
buffer = new CharArrayBuffer(16);
buffer.append(s);
cursor = new ParserCursor(0, s.length());
he = parser.parseHeader(buffer, cursor);
assertEquals("", he.getName());
assertEquals(null, he.getValue());
}