}
public void testParsing() {
String s =
"test; test1 = stuff ; test2 = \"stuff; stuff\"; test3=\"stuff";
ParameterParser parser = new ParameterParser();
List params = parser.parse(s, ';');
assertEquals("test", ((NameValuePair)params.get(0)).getName());
assertEquals(null, ((NameValuePair)params.get(0)).getValue());
assertEquals("test1", ((NameValuePair)params.get(1)).getName());
assertEquals("stuff", ((NameValuePair)params.get(1)).getValue());
assertEquals("test2", ((NameValuePair)params.get(2)).getName());
assertEquals("stuff; stuff", ((NameValuePair)params.get(2)).getValue());
assertEquals("test3", ((NameValuePair)params.get(3)).getName());
assertEquals("\"stuff", ((NameValuePair)params.get(3)).getValue());
s = " test , test1=stuff , , test2=, test3, ";
params = parser.parse(s, ',');
assertEquals("test", ((NameValuePair)params.get(0)).getName());
assertEquals(null, ((NameValuePair)params.get(0)).getValue());
assertEquals("test1", ((NameValuePair)params.get(1)).getName());
assertEquals("stuff", ((NameValuePair)params.get(1)).getValue());
assertEquals("test2", ((NameValuePair)params.get(2)).getName());
assertEquals("", ((NameValuePair)params.get(2)).getValue());
assertEquals("test3", ((NameValuePair)params.get(3)).getName());
assertEquals(null, ((NameValuePair)params.get(3)).getValue());
s = " test";
params = parser.parse(s, ';');
assertEquals("test", ((NameValuePair)params.get(0)).getName());
assertEquals(null, ((NameValuePair)params.get(0)).getValue());
s = " ";
params = parser.parse(s, ';');
assertEquals(0, params.size());
s = " = stuff ";
params = parser.parse(s, ';');
assertEquals(1, params.size());
assertEquals("", ((NameValuePair)params.get(0)).getName());
assertEquals("stuff", ((NameValuePair)params.get(0)).getValue());
}