diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java index 150bfa75687..695b7bb290f 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpFieldsTest.java @@ -29,6 +29,7 @@ import java.nio.ByteBuffer; import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.NoSuchElementException; import java.util.Set; @@ -344,9 +345,29 @@ public class HttpFieldsTest assertEquals(true, e.hasMoreElements()); assertEquals(e.nextElement(), "value1D"); assertEquals(false, e.hasMoreElements()); - } + + @Test + public void testGetQualityValues() throws Exception + { + HttpFields fields = new HttpFields(); + + fields.put("some", "value"); + fields.add("name", "zero;q=0.9,four;q=0.1"); + fields.put("other", "value"); + fields.add("name", "nothing;q=0"); + fields.add("name", "one;q=0.4"); + fields.add("name", "three;x=y;q=0.2;a=b,two;q=0.3"); + + List list = HttpFields.qualityList(fields.getValues("name",",")); + assertEquals("zero",HttpFields.valueParameters(list.get(0),null)); + assertEquals("one",HttpFields.valueParameters(list.get(1),null)); + assertEquals("two",HttpFields.valueParameters(list.get(2),null)); + assertEquals("three",HttpFields.valueParameters(list.get(3),null)); + assertEquals("four",HttpFields.valueParameters(list.get(4),null)); + } + @Test public void testDateFields() throws Exception {