Pairs { public static String join(List<? extends EncodedPair> pairs, char pairSep){ return join(pairs, pairSep, '=', false, false); } private  Pairs(); static EncodedPair toPreEncodedPair(String name, String value); static EncodedPair toPair(String nameToEncode, String valueToEncode, Charset charset); static EncodedPair toPair(String name, String value, Charset charset, boolean encoded); static List<EncodedPair> fromUrlEncoded(String urlEncoded); static List<EncodedPair> sortByNameAndValues(List<? extends EncodedPair> pairs); static String join(List<? extends EncodedPair> pairs, char pairSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static String join(Iterator<? extends EncodedPair> pairs, char pairSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static String join(Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, List<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep); static void join(Writer writer, Iterator<? extends EncodedPair> pairs, char pairSep, char nameValSep, boolean quoteName, boolean quoteVal);  }
@Test public void joinWithWriterListPairNameSepsQuoteNameValuesShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS, 's', 'e', true, true); assertEquals("\"p1\"e\"v1\"s\"p2\"e\"v2\"", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS, 's', 'e', false, true); assertEquals("p1e\"v1\"sp2e\"v2\"", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS, 's', 'e', true, false); assertEquals("\"p1\"ev1s\"p2\"ev2", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS, 's', 'e', false, false); assertEquals("p1ev1sp2ev2", actual.toString()); }
@Test public void joinWithWriterListPairNameSepsShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS, 's', 'e'); assertEquals("p1ev1sp2ev2", actual.toString()); }
@Test public void joinWithWriterListPairSepsShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS, 's'); assertEquals("p1=v1sp2=v2", actual.toString()); }
@Test public void joinWithIteratorPairNameSepsQuoteNameValuesShouldJoinParamsAccordingly() throws IOException { assertEquals("\"p1\"e\"v1\"s\"p2\"e\"v2\"", Pairs.join(PAIRS.iterator(), 's', 'e', true, true)); assertEquals("p1e\"v1\"sp2e\"v2\"", Pairs.join(PAIRS.iterator(), 's', 'e', false, true)); assertEquals("\"p1\"ev1s\"p2\"ev2", Pairs.join(PAIRS.iterator(), 's', 'e', true, false)); assertEquals("p1ev1sp2ev2", Pairs.join(PAIRS.iterator(), 's', 'e', false, false)); }
@Test public void joinWithIteratorPairNameSepsShouldJoinParamsAccordingly() throws IOException { assertEquals("p1ev1sp2ev2", Pairs.join(PAIRS.iterator(), 's', 'e')); }
@Test public void joinWithIteratorPairSepsShouldJoinParamsAccordingly() throws IOException { assertEquals("p1=v1sp2=v2", Pairs.join(PAIRS.iterator(), 's')); }
@Test public void joinWithListPairNameSepsQuoteNameValuesShouldJoinParamsAccordingly() throws IOException { assertEquals("\"p1\"e\"v1\"s\"p2\"e\"v2\"", Pairs.join(PAIRS, 's', 'e', true, true)); assertEquals("p1e\"v1\"sp2e\"v2\"", Pairs.join(PAIRS, 's', 'e', false, true)); assertEquals("\"p1\"ev1s\"p2\"ev2", Pairs.join(PAIRS, 's', 'e', true, false)); assertEquals("p1ev1sp2ev2", Pairs.join(PAIRS, 's', 'e', false, false)); }
@Test public void joinWithListPairNameSepsShouldJoinParamsAccordingly() throws IOException { assertEquals("p1ev1sp2ev2", Pairs.join(PAIRS, 's', 'e')); }
@Test public void joinWithListPairSepsShouldJoinParamsAccordingly() throws IOException { assertEquals("p1=v1sp2=v2", Pairs.join(PAIRS, 's')); }
@Test public void joinWithWriterIteratorPairNameSepsQuoteNameValuesShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's', 'e', true, true); assertEquals("\"p1\"e\"v1\"s\"p2\"e\"v2\"", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's', 'e', false, true); assertEquals("p1e\"v1\"sp2e\"v2\"", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's', 'e', true, false); assertEquals("\"p1\"ev1s\"p2\"ev2", actual.toString()); actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's', 'e', false, false); assertEquals("p1ev1sp2ev2", actual.toString()); }
@Test public void joinWithWriterIteratorPairNameSepsShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's', 'e'); assertEquals("p1ev1sp2ev2", actual.toString()); }
@Test public void joinWithWriterIteratorPairSepsShouldJoinParamsAccordingly() throws IOException { StringWriter actual = new StringWriter(); Pairs.join(actual, PAIRS.iterator(), 's'); assertEquals("p1=v1sp2=v2", actual.toString()); }