@Test
public void testNVParse() {

    String s = "test";
    CharArrayBuffer buffer = new CharArrayBuffer(64);
    buffer.append(s);
    ParserCursor cursor = new ParserCursor(0, s.length());
    NameValuePair param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals(null, param.getValue());
    Assert.assertEquals(s.length(), cursor.getPos());
    Assert.assertTrue(cursor.atEnd());
    s = "test;";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals(null, param.getValue());
    Assert.assertEquals(s.length(), cursor.getPos());
    Assert.assertTrue(cursor.atEnd());
    s = "test  ,12";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals(null, param.getValue());
    Assert.assertEquals(s.length() - 2, cursor.getPos());
    Assert.assertFalse(cursor.atEnd());
    s = "test=stuff";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals("stuff", param.getValue());
    Assert.assertEquals(s.length(), cursor.getPos());
    Assert.assertTrue(cursor.atEnd());
    s = "   test  =   stuff ";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals("stuff", param.getValue());
    Assert.assertEquals(s.length(), cursor.getPos());
    Assert.assertTrue(cursor.atEnd());
    s = "   test  =   stuff ;1234";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals("stuff", param.getValue());
    Assert.assertEquals(s.length() - 4, cursor.getPos());
    Assert.assertFalse(cursor.atEnd());
    s = "test  = \"stuff\"";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals("stuff", param.getValue());
    s = "test  = \"  stuff\\\"\"";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals("  stuff\"", param.getValue());
    s = "  test";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("test", param.getName());
    Assert.assertEquals(null, param.getValue());
    s = "  ";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("", param.getName());
    Assert.assertEquals(null, param.getValue());
    s = " = stuff ";
    buffer = new CharArrayBuffer(16);
    buffer.append(s);
    cursor = new ParserCursor(0, s.length());
    param = this.parser.parseNameValuePair(buffer, cursor);
    Assert.assertEquals("", param.getName());
    Assert.assertEquals("stuff", param.getValue());
}