QuotedQualityCSV extends QuotedCSV implements Iterable<String> { public List<String> getValues() { if (!sorted) { sort(); } return values; } QuotedQualityCSV();  QuotedQualityCSV(String[] preferredOrder);  QuotedQualityCSV(Function<String, Integer> secondaryOrdering); List<String> getValues(); @Override Iterator<String> iterator(); static Function<String, Integer> MOST_SPECIFIC; }
@Test void test7231_5_3_2_example1() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(" audio/*; q=0.2, audio/basic"); assertContains(values.getValues(), "audio/basic", "audio/*"); }
@Test void test7231_5_3_2_example2() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text/plain; q=0.5, text/html,"); values.addValue("text/x-dvi; q=0.8, text/x-c"); assertContains(values.getValues(), "text/html", "text/x-c", "text/x-dvi", "text/plain"); }
@Test void test7231_5_3_2_example3() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text*"); assertContains(values.getValues(), "text*"); }
@Test void test7231_5_3_2_example3_most_specific() { QuotedQualityCSV values = new QuotedQualityCSV(QuotedQualityCSV.MOST_SPECIFIC); values.addValue("text*"); assertContains(values.getValues(), "text/plain;format=flowed", "text/plain", "text*"); }
@Test void test7231_5_3_2_example4() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("text*;q=0.5"); assertContains(values.getValues(), "text/html;level=1", "text/html", "*/*", "text/html;level=2", "text/*" ); }
@Test void test7231_5_3_4_example1() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("compress, gzip"); values.addValue(""); values.addValue("*"); values.addValue("compress;q=0.5, gzip;q=1.0"); values.addValue("gzip;q=1.0, identity; q=0.5, *;q=0"); assertContains(values.getValues(), "compress", "gzip", "*", "gzip", "gzip", "compress", "identity" ); }
@Test void testOWS() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(" value 0.5 ; p = v ; q =0.5 , value 1.0 "); assertContains(values.getValues(), "value 1.0", "value 0.5;p=v"); }
@Test void testEmpty() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(",aaaa, , bbbb ,,cccc,"); assertContains(values.getValues(), "aaaa", "bbbb", "cccc"); }
@Test void testQuoted() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(" value 0.5 ; p = \"v ; q = \\\"0.5\\\" , value 1.0 \" "); assertContains(values.getValues(), "value 0.5;p=\"v ; q = \\\"0.5\\\" , value 1.0 \""); }
@Test void testOpenQuote() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("value;p=\"v"); assertContains(values.getValues(), "value;p=\"v"); }
@Test void testQuotedQuality() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue(" value 0.5 ; p = v ; q = \"0.5\" , value 1.0 "); assertContains(values.getValues(), "value 1.0", "value 0.5;p=v"); }
@Test void testBadQuality() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("value0.5;p=v;q=0.5,value1.0,valueBad;q=X"); assertContains(values.getValues(), "value1.0", "value0.5;p=v"); }
@Test void testFirefoxContentEncodingWithBrotliPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferBrotli); values.addValue("gzip, deflate, br"); assertContains(values.getValues(), "br", "gzip", "deflate"); }
@Test void testFirefoxContentEncodingWithGzipPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferGzip); values.addValue("gzip, deflate, br"); assertContains(values.getValues(), "gzip", "br", "deflate"); }
@Test void testFirefoxContentEncodingWithNoPreference() { QuotedQualityCSV values = new QuotedQualityCSV(noFormats); values.addValue("gzip, deflate, br"); assertContains(values.getValues(), "gzip", "deflate", "br"); }
@Test void testChromeContentEncodingWithBrotliPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferBrotli); values.addValue("gzip, deflate, sdch, br"); assertContains(values.getValues(), "br", "gzip", "deflate", "sdch"); }
@Test void testComplexEncodingWithGzipPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferGzip); values.addValue("gzip;q=0.9, identity;q=0.1, *;q=0.01, deflate;q=0.9, sdch;q=0.7, br;q=0.9"); assertContains(values.getValues(), "gzip", "br", "deflate", "sdch", "identity", "*"); }
@Test void testComplexEncodingWithBrotliPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferBrotli); values.addValue("gzip;q=0.9, identity;q=0.1, *;q=0, deflate;q=0.9, sdch;q=0.7, br;q=0.99"); assertContains(values.getValues(), "br", "gzip", "deflate", "sdch", "identity"); }
@Test void testStarEncodingWithGzipPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferGzip); values.addValue("br, *"); assertContains(values.getValues(), "*", "br"); }
@Test void testStarEncodingWithBrotliPreference() { QuotedQualityCSV values = new QuotedQualityCSV(preferBrotli); values.addValue("gzip, *"); assertContains(values.getValues(), "*", "gzip"); }
@Test void testSameQuality() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("one;q=0.5,two;q=0.5,three;q=0.5"); assertContains(values.getValues(), "one", "two", "three"); }
@Test void testNoQuality() { QuotedQualityCSV values = new QuotedQualityCSV(); values.addValue("one,two;,three;x=y"); assertContains(values.getValues(), "one", "two", "three;x=y"); }