This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 000b554  RestClient tests.
000b554 is described below

commit 000b554916ee289437ab79694ecb82f8b874cd0e
Author: JamesBognar <[email protected]>
AuthorDate: Mon Jun 29 09:30:35 2020 -0400

    RestClient tests.
---
 .../juneau/assertions/FluentStringAssertion.java   |  68 +++++++---
 .../client2/Remote_FormDataAnnotation_Test.java    | 110 ++++++++-------
 .../rest/client2/Remote_HeaderAnnotation_Test.java |  68 ++++++----
 .../rest/client2/Remote_PathAnnotation_Test.java   |  72 ++++++----
 .../rest/client2/Remote_QueryAnnotation_Test.java  |  80 ++++++-----
 .../Remote_RemoteMethodAnnotation_Test.java        |  22 ++-
 .../client2/Remote_RequestAnnotation_Test.java     |  18 ++-
 .../client2/Remote_ResponseAnnotation_Test.java    |  10 +-
 .../rest/client2/RestClient_FormData_Test.java     | 149 +++++++++++----------
 .../juneau/rest/client2/RestClient_Query_Test.java |  20 +--
 .../juneau/rest/client2/RestClient_Test.java       |  10 +-
 .../juneau/rest/client2/RestClientBuilder.java     |   2 +-
 12 files changed, 382 insertions(+), 247 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
index 442c431..07eb161 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/assertions/FluentStringAssertion.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.internal.StringUtils.*;
 import java.util.*;
 import java.util.function.*;
 import java.util.regex.*;
+import java.util.stream.*;
 
 import org.apache.juneau.internal.*;
 
@@ -75,9 +76,7 @@ public class FluentStringAssertion<R> extends 
FluentAssertion<R> {
         */
        @FluentSetter
        public FluentStringAssertion<R> replaceAll(String regex, String 
replacement) {
-               if (text != null)
-                       text = text.replaceAll(regex, replacement);
-               return this;
+               return apply(x -> x == null ? null : text.replaceAll(regex, 
replacement));
        }
 
        /**
@@ -89,8 +88,53 @@ public class FluentStringAssertion<R> extends 
FluentAssertion<R> {
         */
        @FluentSetter
        public FluentStringAssertion<R> replace(String target, String 
replacement) {
-               if (text != null)
-                       text = text.replace(target, replacement);
+               return apply(x -> x == null ? null : text.replace(target, 
replacement));
+       }
+
+       /**
+        * URL-decodes the text in this assertion.
+        *
+        * @return The response object (for method chaining).
+        */
+       public FluentStringAssertion<R> urlDecode() {
+               return apply(x->StringUtils.urlDecode(x));
+       }
+
+       /**
+        * Sorts the contents of the text by lines.
+        *
+        * @return The response object (for method chaining).
+        */
+       public FluentStringAssertion<R> sort() {
+               return apply(x->x == null ? null : 
Arrays.asList(x.trim().split("[\r\n]+")).stream().sorted().collect(Collectors.joining("\n")));
+       }
+
+       /**
+        * Converts the text to lowercase.
+        *
+        * @return The response object (for method chaining).
+        */
+       public FluentStringAssertion<R> lc() {
+               return apply(x->x == null ? null : x.toLowerCase());
+       }
+
+       /**
+        * Converts the text to uppercase.
+        *
+        * @return The response object (for method chaining).
+        */
+       public FluentStringAssertion<R> uc() {
+               return apply(x->x == null ? null : x.toUpperCase());
+       }
+
+       /**
+        * Applies an abitrary function against the text in this assertion.
+        *
+        * @param f The function to apply.
+        * @return The response object (for method chaining).
+        */
+       public FluentStringAssertion<R> apply(Function<String,String> f) {
+               text = f.apply(text);
                return this;
        }
 
@@ -226,20 +270,6 @@ public class FluentStringAssertion<R> extends 
FluentAssertion<R> {
        }
 
        /**
-        * Asserts that the text equals the specified value after the text has 
been URL-decoded.
-        *
-        * @param value The value to check against.
-        * @return The response object (for method chaining).
-        * @throws AssertionError If assertion failed.
-        */
-       public R urlDecodedIs(String value) throws AssertionError {
-               String t = urlDecode(text);
-               if (! isEqualsIc(value, t))
-                       throw error("Text differed at position 
{0}.\n\tExpected=[{1}]\n\tActual=[{2}]", diffPosition(value, text), fix(value), 
fix(t));
-               return returns();
-       }
-
-       /**
         * Asserts that the text equals the specified value ignoring case.
         *
         * @param value The value to check against.
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_FormDataAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_FormDataAnnotation_Test.java
index 84d8f24..494c1cf 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_FormDataAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_FormDataAnnotation_Test.java
@@ -85,6 +85,7 @@ public class Remote_FormDataAnnotation_Test {
                @RemoteMethod(path="a") String postX18(@FormData InputStream b);
                @RemoteMethod(path="a") String postX19(@FormData("*") 
NameValuePairs b);
                @RemoteMethod(path="a") String postX20(@FormData NameValuePairs 
b);
+               @RemoteMethod(path="a") String postX21(@FormData NameValuePair 
b);
        }
 
        @Test
@@ -108,8 +109,9 @@ public class Remote_FormDataAnnotation_Test {
                assertEquals("{x:'1'}", x.postX16(new StringReader("x=1")));
                assertEquals("{x:'1'}", x.postX17(new 
StringInputStream("x=1")));
                assertEquals("{x:'1'}", x.postX18(new 
StringInputStream("x=1")));
-               assertEquals("{foo:'bar'}", x.postX19(new 
NameValuePairs().append("foo", "bar")));
-               assertEquals("{foo:'bar'}", x.postX20(new 
NameValuePairs().append("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.postX19(pairs("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.postX20(pairs("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.postX21(pair("foo", "bar")));
        }
 
        
//=================================================================================================================
@@ -134,7 +136,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void b01_default_allowEmptyValue() throws Exception {
-               B1 x = MockRestClient.build(B.class).getRemote(B1.class);
+               B1 x = remote(B.class, B1.class);
                assertEquals("{x:'foo'}", x.postX1(null));
                assertThrown(()->{x.postX1("");}).contains("Empty value not 
allowed");
                assertEquals("{x:'foo'}", x.postX2(null));
@@ -179,24 +181,23 @@ public class Remote_FormDataAnnotation_Test {
                @RemoteMethod(path="/b") String 
postX14(@FormData(n="x",cf="uon") String...b);
        }
 
-       private static C1 cr = 
MockRestClient.build(C.class).getRemote(C1.class);
-
        @Test
        public void c01_collectionFormat() throws Exception {
-               assertEquals("{x:'foo,bar'}", cr.postX1("foo","bar"));
-               assertEquals("x=foo%2Cbar", cr.postX2("foo","bar"));
-               assertEquals("{x:'foo,bar'}", cr.postX3("foo","bar"));
-               assertEquals("x=foo%2Cbar", cr.postX4("foo","bar"));
-               assertEquals("{x:'foo bar'}", cr.postX5("foo","bar"));
-               assertEquals("x=foo+bar", cr.postX6("foo","bar"));
-               assertEquals("{x:'foo\\tbar'}", cr.postX7("foo","bar"));
-               assertEquals("x=foo%09bar", cr.postX8("foo","bar"));
-               assertEquals("{x:'foo|bar'}", cr.postX9("foo","bar"));
-               assertEquals("x=foo%7Cbar", cr.postX10("foo","bar"));
-               assertEquals("{x:'foo,bar'}", cr.postX11("foo","bar"));
-               assertEquals("x=foo%2Cbar", cr.postX12("foo","bar"));
-               assertEquals("{x:'@(foo,bar)'}", cr.postX13("foo","bar"));
-               assertEquals("x=%40%28foo%2Cbar%29", cr.postX14("foo","bar"));
+               C1 x = remote(C.class, C1.class);
+               assertEquals("{x:'foo,bar'}", x.postX1("foo","bar"));
+               assertEquals("x=foo%2Cbar", x.postX2("foo","bar"));
+               assertEquals("{x:'foo,bar'}", x.postX3("foo","bar"));
+               assertEquals("x=foo%2Cbar", x.postX4("foo","bar"));
+               assertEquals("{x:'foo bar'}", x.postX5("foo","bar"));
+               assertEquals("x=foo+bar", x.postX6("foo","bar"));
+               assertEquals("{x:'foo\\tbar'}", x.postX7("foo","bar"));
+               assertEquals("x=foo%09bar", x.postX8("foo","bar"));
+               assertEquals("{x:'foo|bar'}", x.postX9("foo","bar"));
+               assertEquals("x=foo%7Cbar", x.postX10("foo","bar"));
+               assertEquals("{x:'foo,bar'}", x.postX11("foo","bar"));
+               assertEquals("x=foo%2Cbar", x.postX12("foo","bar"));
+               assertEquals("{x:'@(foo,bar)'}", x.postX13("foo","bar"));
+               assertEquals("x=%40%28foo%2Cbar%29", x.postX14("foo","bar"));
        }
 
        
//=================================================================================================================
@@ -260,7 +261,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void d01_min_max_emin_emax() throws Exception {
-               D1 x = MockRestClient.build(D.class).getRemote(D1.class);
+               D1 x = remote(D.class, D1.class);
                assertEquals("{x:'1'}", x.postX1(1));
                assertEquals("{x:'10'}", x.postX1(10));
                assertThrown(()->{x.postX1(0);}).contains("Minimum value not 
met");
@@ -473,7 +474,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void e01_mini_maxi_ui() throws Exception {
-               E1 x = MockRestClient.build(E.class).getRemote(E1.class);
+               E1 x = remote(E.class, E1.class);
                assertEquals("{x:'1'}", x.postX1("1"));
                assertEquals("{x:'1|2'}", x.postX1("1","2"));
                assertThrown(()->{x.postX1();}).contains("Minimum number of 
items not met");
@@ -516,7 +517,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void f01_minl_maxl_enum_pattern() throws Exception {
-               F1 x = MockRestClient.build(F.class).getRemote(F1.class);
+               F1 x = remote(F.class, F1.class);
                assertEquals("{x:'12'}", x.postX1("12"));
                assertEquals("{x:'123'}", x.postX1("123"));
                assertThrown(()->{x.postX1("1");}).contains("Minimum length of 
value not met");
@@ -573,7 +574,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void g01_multipleOf() throws Exception {
-               G1 x = MockRestClient.build(G.class).getRemote(G1.class);
+               G1 x = remote(G.class, G1.class);
                assertEquals("{x:'4'}", x.postX1(4));
                assertThrown(()->{x.postX1(5);}).contains("Multiple-of not 
met");
                assertEquals("{x:'4'}", x.postX2((short)4));
@@ -625,7 +626,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void h01_required() throws Exception {
-               H1 x = MockRestClient.build(H.class).getRemote(H1.class);
+               H1 x = remote(H.class, H1.class);
                assertEquals("{}", x.postX1(null));
                assertEquals("{}", x.postX2(null));
                assertEquals("{x:'1'}", x.postX3("1"));
@@ -653,7 +654,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void i01_skipIfEmpty() throws Exception {
-               I1 x = MockRestClient.build(I.class).getRemote(I1.class);
+               I1 x = remote(I.class, I1.class);
                assertEquals("{x:''}", x.postX1(""));
                assertEquals("{x:''}", x.postX2(""));
                assertEquals("{}", x.postX3(""));
@@ -678,7 +679,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void j01_serializer() throws Exception {
-               J1 x = MockRestClient.build(J.class).getRemote(J1.class);
+               J1 x = remote(J.class, J1.class);
                assertEquals("{x:'xXx'}", x.postX1("X"));
        }
 
@@ -749,8 +750,8 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void k01_requestBean_simpleVals() throws Exception {
-               K1 x1 = MockRestClient.build(K.class).getRemote(K1.class);
-               K1 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
+               K1 x1 = remote(K.class, K1.class);
+               K1 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'true',h:'123',i1:'foo'}", 
x1.postX1(new K1a()));
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'\\'true\\'',h:'\\'123\\'',i1:'foo'}",
 x2.postX1(new K1a()));
                
assertEquals("{a:'xa1x',b:'xb1x',c:'xc1x',e:'xx',g:'xtruex',h:'x123x',i1:'xfoox'}",
 x2.postX2(new K1a()));
@@ -787,11 +788,11 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void k02_requestBean_maps() throws Exception {
-               K2 c02a = MockRestClient.build(K.class).getRemote(K2.class);
-               K2 c02b = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
-               
assertEquals("{a:'a1=v1,a2=123,a3=null,a4=',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:''}",
 c02a.postX1(new K2a()));
-               
assertEquals("{a:'(a1=v1,a2=123,a3=null,a4=\\'\\')',b1:'\\'true\\'',b2:'\\'123\\'',b3:'\\'null\\'',c1:'v1',c2:'123',c4:''}",
 c02b.postX1(new K2a()));
-               
assertEquals("{a:'x{a1:\\'v1\\',a2:123,a3:null,a4:\\'\\'}x',b1:'xtruex',b2:'x123x',b3:'xnullx',c1:'xv1x',c2:'x123x',c4:'xx'}",
 c02b.postX2(new K2a()));
+               K2 x1 = remote(K.class, K2.class);
+               K2 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
+               
assertEquals("{a:'a1=v1,a2=123,a3=null,a4=',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:''}",
 x1.postX1(new K2a()));
+               
assertEquals("{a:'(a1=v1,a2=123,a3=null,a4=\\'\\')',b1:'\\'true\\'',b2:'\\'123\\'',b3:'\\'null\\'',c1:'v1',c2:'123',c4:''}",
 x2.postX1(new K2a()));
+               
assertEquals("{a:'x{a1:\\'v1\\',a2:123,a3:null,a4:\\'\\'}x',b1:'xtruex',b2:'x123x',b3:'xnullx',c1:'xv1x',c2:'x123x',c4:'xx'}",
 x2.postX2(new K2a()));
        }
 
        
//=================================================================================================================
@@ -807,15 +808,15 @@ public class Remote_FormDataAnnotation_Test {
        public static class K3a {
                @FormData
                public NameValuePairs getA() {
-                       return new 
NameValuePairs().append("a1","v1").append("a2", 123).append("a3", 
null).append("a4", "");
+                       return pairs("a1","v1").append("a2", 123).append("a3", 
null).append("a4", "");
                }
                @FormData("*")
                public NameValuePairs getB() {
-                       return new 
NameValuePairs().append("b1","true").append("b2", "123").append("b3", "null");
+                       return pairs("b1","true").append("b2", 
"123").append("b3", "null");
                }
                @FormData(n="*")
                public NameValuePairs getC() {
-                       return new 
NameValuePairs().append("c1","v1").append("c2", 123).append("c3", 
null).append("c4", "");
+                       return pairs("c1","v1","c2", 123,"c3", null,"c4", "");
                }
                @FormData("*")
                public NameValuePairs getD() {
@@ -823,18 +824,18 @@ public class Remote_FormDataAnnotation_Test {
                }
                @FormData
                public NameValuePair[] getE() {
-                       return new 
NameValuePairs().append("e1","v1").append("e2", 123).append("e3", 
null).append("e4", "").toArray(new NameValuePair[0]);
+                       return 
pairs("e1","v1","e2",123,"e3",null,"e4","").toArray(new NameValuePair[0]);
                }
                @FormData
                public BasicNameValuePair[] getF() {
-                       return new 
NameValuePairs().append("f1","v1").append("f2", 123).append("f3", 
null).append("f4", "").toArray(new BasicNameValuePair[0]);
+                       return 
pairs("f1","v1","f2",123,"f3",null,"f4","").toArray(new BasicNameValuePair[0]);
                }
        }
 
        @Test
        public void k03_requestBean_nameValuePairs() throws Exception {
-               K3 x1 = MockRestClient.build(K.class).getRemote(K3.class);
-               K3 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
+               K3 x1 = remote(K.class, K3.class);
+               K3 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x1.postX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.postX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.postX2(new K3a()));
@@ -858,7 +859,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void k04_requestBean_charSequence() throws Exception {
-               K4 x = MockRestClient.build(K.class).getRemote(K4.class);
+               K4 x = remote(K.class, K4.class);
                assertEquals("{baz:'qux',foo:'bar'}", x.post(new C04_Bean()));
        }
 
@@ -880,7 +881,7 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void k05_requestBean_reader() throws Exception {
-               K5 x = MockRestClient.build(K.class).getRemote(K5.class);
+               K5 x = remote(K.class, K5.class);
                assertEquals("{baz:'qux',foo:'bar'}", x.post(new K5a()));
        }
 
@@ -935,15 +936,30 @@ public class Remote_FormDataAnnotation_Test {
 
        @Test
        public void k06_requestBean_collections() throws Exception {
-               K6 x1 = MockRestClient.build(K.class).getRemote(K6.class);
-               K6 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K6.class);
+               K6 x1 = remote(K.class, K6.class);
+               K6 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K6.class);
                
assertEquals("{a:'foo,,true,123,null,true,123,null',b:'foo,,true,123,null,true,123,null',c:'foo||true|123|null|true|123|null',d:'',f:'foo,,true,123,null,true,123,null',g:'foo||true|123|null|true|123|null',h:''}",
 x1.postX1(new K6a()));
                
assertEquals("{a:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',b:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',c:'foo||true|123|null|true|123|null',d:'@()',f:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',g:'foo||true|123|null|true|123|null',h:'@()'}",
 x2.postX1(new K6a()));
                
assertEquals("{a:'fooXXtrueX123XnullXtrueX123Xnull',b:'fooXXtrueX123XnullXtrueX123Xnull',c:'foo||true|123|null|true|123|null',d:'',f:'fooXXtrueX123XnullXtrueX123Xnull',g:'foo||true|123|null|true|123|null',h:''}",
 x2.postX2(new K6a()));
        }
 
-       
//=================================================================================================================
-       // Support classes
-       
//=================================================================================================================
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static NameValuePair pair(String name, Object val) {
+               return BasicNameValuePair.of(name, val);
+       }
 
+       private static NameValuePairs pairs(Object...pairs) {
+               return NameValuePairs.of(pairs);
+       }
+
+       private static RestClientBuilder client(Class<?> c) {
+               return MockRestClient.create(c);
+       }
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_HeaderAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_HeaderAnnotation_Test.java
index b80b778..f54ae44 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_HeaderAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_HeaderAnnotation_Test.java
@@ -83,7 +83,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void a01_objectTypes() throws Exception {
-               A1 x = MockRestClient.build(A.class).getRemote(A1.class);
+               A1 x = remote(A.class, A1.class);
                assertEquals("{x:'1'}", x.getX1(1));
                assertEquals("{x:'1.0'}", x.getX2(1));
                assertEquals("{x:'f=1'}", x.getX3(Bean.create()));
@@ -98,8 +98,8 @@ public class Remote_HeaderAnnotation_Test {
                assertEquals("{k1:'f=1'}", 
x.getX12(AMap.of("k1",Bean.create())));
                assertEquals("{x:'k1=f\\\\=1'}", 
x.getX13(AMap.of("k1",Bean.create())));
                assertEquals("{k1:'f=1'}", 
x.getX14(AMap.of("k1",Bean.create())));
-               assertEquals("{foo:'bar'}", x.getX15(new 
NameValuePairs().append("foo", "bar")));
-               assertEquals("{foo:'bar'}", x.getX16(new 
NameValuePairs().append("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.getX15(pairs("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.getX16(pairs("foo", "bar")));
        }
 
        
//=================================================================================================================
@@ -125,7 +125,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void b01_default_allowEmptyValue() throws Exception {
-               B1 x = MockRestClient.build(B.class).getRemote(B1.class);
+               B1 x = remote(B.class, B1.class);
                assertEquals("{x:'foo'}", x.getX1(null));
                assertThrown(()->{x.getX1("");}).contains("Empty value not 
allowed");
                assertEquals("{x:'foo'}", x.getX2(null));
@@ -162,7 +162,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void c01_collectionFormat() throws Exception {
-               C1 x = MockRestClient.build(C.class).getRemote(C1.class);
+               C1 x = remote(C.class, C1.class);
                assertEquals("{x:'foo,bar'}", x.getX1("foo","bar"));
                assertEquals("{x:'foo,bar'}", x.getX2("foo","bar"));
                assertEquals("{x:'foo bar'}", x.getX3("foo","bar"));
@@ -233,7 +233,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void d01_min_max_emin_emax() throws Exception {
-               D1 x = MockRestClient.build(D.class).getRemote(D1.class);
+               D1 x = remote(D.class, D1.class);
                assertEquals("{x:'1'}", x.getX1(1));
                assertEquals("{x:'10'}", x.getX1(10));
                assertThrown(()->{x.getX1(0);}).contains("Minimum value not 
met");
@@ -447,7 +447,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void e01_mini_maxi_ui() throws Exception {
-               E1 x = MockRestClient.build(E.class).getRemote(E1.class);
+               E1 x = remote(E.class, E1.class);
                assertEquals("{x:'1'}", x.getX1("1"));
                assertEquals("{x:'1|2'}", x.getX1("1","2"));
                assertThrown(()->{x.getX1();}).contains("Minimum number of 
items not met");
@@ -491,7 +491,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void f01_minl_maxl_enum_p() throws Exception {
-               F1 x = MockRestClient.build(F.class).getRemote(F1.class);
+               F1 x = remote(F.class, F1.class);
                assertEquals("{x:'12'}", x.getX1("12"));
                assertEquals("{x:'123'}", x.getX1("123"));
                assertThrown(()->{x.getX1("1");}).contains("Minimum length of 
value not met");
@@ -549,7 +549,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void g01_multipleOf() throws Exception {
-               G1 x = MockRestClient.build(G.class).getRemote(G1.class);
+               G1 x = remote(G.class, G1.class);
                assertEquals("{x:'4'}", x.getX1(4));
                assertThrown(()->{x.getX1(5);}).contains("Multiple-of not met");
                assertEquals("{x:'4'}", x.getX2((short)4));
@@ -594,7 +594,7 @@ public class Remote_HeaderAnnotation_Test {
        }
 
        @Remote
-       public static interface HR {
+       public static interface H1 {
                @RemoteMethod(path="/") String getX1(@Header(n="x") String b);
                @RemoteMethod(path="/") String getX2(@Header(n="x",r=false) 
String b);
                @RemoteMethod(path="/") String getX3(@Header(n="x",r=true) 
String b);
@@ -602,7 +602,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void h01_required() throws Exception {
-               HR x = MockRestClient.build(H.class).getRemote(HR.class);
+               H1 x = remote(H.class, H1.class);
                assertEquals("{}", x.getX1(null));
                assertEquals("{}", x.getX2(null));
                assertEquals("{x:'1'}", x.getX3("1"));
@@ -631,7 +631,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void h01_skipIfEmpty() throws Exception {
-               I1 x = MockRestClient.build(I.class).getRemote(I1.class);
+               I1 x = remote(I.class, I1.class);
                assertEquals("{x:''}", x.getX1(""));
                assertEquals("{x:''}", x.getX2(""));
                assertEquals("{}", x.getX3(""));
@@ -657,7 +657,7 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void j01_serializer() throws Exception {
-               J1 x = MockRestClient.build(J.class).getRemote(J1.class);
+               J1 x = remote(J.class, J1.class);
                assertEquals("{x:'xXx'}", x.getX1("X"));
        }
 
@@ -728,8 +728,8 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void k01_requestBean_simpleVals() throws Exception {
-               K1 x1 = MockRestClient.build(K.class).getRemote(K1.class);
-               K1 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
+               K1 x1 = remote(K.class, K1.class);
+               K1 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'true',h:'123',i1:'foo'}", 
x1.getX1(new K1a()));
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'\\'true\\'',h:'\\'123\\'',i1:'foo'}",
 x2.getX1(new K1a()));
                
assertEquals("{a:'xa1x',b:'xb1x',c:'xc1x',e:'xx',g:'xtruex',h:'x123x',i1:'xfoox'}",
 x2.getX2(new K1a()));
@@ -766,8 +766,8 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void k02_requestBean_maps() throws Exception {
-               K2 x1 = MockRestClient.build(K.class).getRemote(K2.class);
-               K2 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
+               K2 x1 = remote(K.class, K2.class);
+               K2 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
                
assertEquals("{a:'a1=v1,a2=123,a3=null,a4=',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:''}",
 x1.getX1(new K2a()));
                
assertEquals("{a:'(a1=v1,a2=123,a3=null,a4=\\'\\')',b1:'\\'true\\'',b2:'\\'123\\'',b3:'\\'null\\'',c1:'v1',c2:'123',c4:''}",
 x2.getX1(new K2a()));
                
assertEquals("{a:'x{a1:\\'v1\\',a2:123,a3:null,a4:\\'\\'}x',b1:'xtruex',b2:'x123x',b3:'xnullx',c1:'xv1x',c2:'x123x',c4:'xx'}",
 x2.getX2(new K2a()));
@@ -786,15 +786,15 @@ public class Remote_HeaderAnnotation_Test {
        public static class K3a {
                @Header(aev=true)
                public NameValuePairs getA() {
-                       return new 
NameValuePairs().append("a1","v1").append("a2", 123).append("a3", 
null).append("a4", "");
+                       return pairs("a1","v1","a2",123,"a3",null,"a4","");
                }
                @Header(value="*",aev=true)
                public NameValuePairs getB() {
-                       return new 
NameValuePairs().append("b1","true").append("b2", "123").append("b3", "null");
+                       return pairs("b1","true","b2","123","b3","null");
                }
                @Header(n="*",aev=true)
                public NameValuePairs getC() {
-                       return new 
NameValuePairs().append("c1","v1").append("c2", 123).append("c3", 
null).append("c4", "");
+                       return pairs("c1","v1","c2", 123,"c3",null,"c4","");
                }
                @Header(value="*",aev=true)
                public NameValuePairs getD() {
@@ -802,18 +802,18 @@ public class Remote_HeaderAnnotation_Test {
                }
                @Header(aev=true)
                public NameValuePair[] getE() {
-                       return new 
NameValuePairs().append("e1","v1").append("e2", 123).append("e3", 
null).append("e4", "").toArray(new NameValuePair[0]);
+                       return 
pairs("e1","v1","e2",123,"e3",null,"e4","").toArray(new NameValuePair[0]);
                }
                @Header(aev=true)
                public BasicNameValuePair[] getF() {
-                       return new 
NameValuePairs().append("f1","v1").append("f2", 123).append("f3", 
null).append("f4", "").toArray(new BasicNameValuePair[0]);
+                       return 
pairs("f1","v1","f2",123,"f3",null,"f4","").toArray(new BasicNameValuePair[0]);
                }
        }
 
        @Test
        public void k03_requestBean_nameValuePairs() throws Exception {
-               K3 x1 = MockRestClient.build(K.class).getRemote(K3.class);
-               K3 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
+               K3 x1 = remote(K.class, K3.class);
+               K3 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x1.getX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.getX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.getX2(new K3a()));
@@ -870,10 +870,26 @@ public class Remote_HeaderAnnotation_Test {
 
        @Test
        public void k04_requestBean_collections() throws Exception {
-               K4 x1 = MockRestClient.build(K.class).getRemote(K4.class);
-               K4 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K4.class);
+               K4 x1 = remote(K.class, K4.class);
+               K4 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K4.class);
                
assertEquals("{a:'foo,,true,123,null,true,123,null',b:'foo,,true,123,null,true,123,null',c:'foo||true|123|null|true|123|null',d:'',f:'foo,,true,123,null,true,123,null',g:'foo||true|123|null|true|123|null',h:''}",
 x1.getX1(new K4a()));
                
assertEquals("{a:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',b:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',c:'foo||true|123|null|true|123|null',d:'@()',f:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',g:'foo||true|123|null|true|123|null',h:'@()'}",
 x2.getX1(new K4a()));
                
assertEquals("{a:'fooXXtrueX123XnullXtrueX123Xnull',b:'fooXXtrueX123XnullXtrueX123Xnull',c:'foo||true|123|null|true|123|null',d:'',f:'fooXXtrueX123XnullXtrueX123Xnull',g:'foo||true|123|null|true|123|null',h:''}",
 x2.getX2(new K4a()));
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static NameValuePairs pairs(Object...pairs) {
+               return NameValuePairs.of(pairs);
+       }
+
+       private static RestClientBuilder client(Class<?> c) {
+               return MockRestClient.create(c);
+       }
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_PathAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_PathAnnotation_Test.java
index be101cc..203f866 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_PathAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_PathAnnotation_Test.java
@@ -86,7 +86,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void a01_path_objectTypes() throws Exception {
-               A1 x = MockRestClient.build(A.class).getRemote(A1.class);
+               A1 x = remote(A.class, A1.class);
                assertEquals("1", x.getX1(1));
                assertEquals("1.0", x.getX2(1));
                assertEquals("x=1", x.getX3(Bean.create()));
@@ -101,12 +101,12 @@ public class Remote_PathAnnotation_Test {
                assertEquals("x=1", x.getX12(AMap.of("x",Bean.create())));
                assertEquals("(x=(x=1))", x.getX13(AMap.of("x",Bean.create())));
                assertEquals("x=1", x.getX14(AMap.of("x",Bean.create())));
-               assertEquals("bar", x.getX15(new NameValuePairs().append("x", 
"bar")));
-               assertEquals("bar", x.getX16(new NameValuePairs().append("x", 
"bar")));
+               assertEquals("bar", x.getX15(pairs("x", "bar")));
+               assertEquals("bar", x.getX16(pairs("x", "bar")));
                assertEquals("(x=(x=1))", x.getX17(AMap.of("x",Bean.create())));
-               assertEquals("bar", x.getX18(BasicNameValuePair.of("x", 
"bar")));
-               assertEquals("bar", x.getX19(BasicNameValuePair.of("x", 
"bar")));
-               assertEquals("bar", x.getX20(new 
NameValuePair[]{BasicNameValuePair.of("x", "bar")}));
+               assertEquals("bar", x.getX18(pair("x", "bar")));
+               assertEquals("bar", x.getX19(pair("x", "bar")));
+               assertEquals("bar", x.getX20(new NameValuePair[]{pair("x", 
"bar")}));
                assertEquals("{x}", x.getX20(null));
                assertThrown(()->{x.getX21("foo");}).contains("Invalid value 
type for path arg 'null': java.lang.String");
        }
@@ -136,7 +136,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void b01_path_collectionFormat() throws Exception {
-               B1 x = MockRestClient.build(B.class).getRemote(B1.class);
+               B1 x = remote(B.class, B1.class);
                assertEquals("foo,bar", x.getX1("foo","bar"));
                assertEquals("foo,bar", x.getX2("foo","bar"));
                assertEquals("foo bar", x.getX3("foo","bar"));
@@ -207,7 +207,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void c01_path_min_max_emin_emax() throws Exception {
-               C1 x = MockRestClient.build(C.class).getRemote(C1.class);
+               C1 x = remote(C.class, C1.class);
                assertEquals("{x:'1'}", x.getX1(1));
                assertEquals("{x:'10'}", x.getX1(10));
                assertThrown(()->{x.getX1(0);}).contains("Minimum value not 
met");
@@ -403,7 +403,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void d01_path_miniMaxi() throws Exception {
-               D1 x = MockRestClient.build(D.class).getRemote(D1.class);
+               D1 x = remote(D.class, D1.class);
                assertEquals("{x:'1'}", x.getX1("1"));
                assertEquals("{x:'1|2'}", x.getX1("1","2"));
                assertThrown(()->{x.getX1();}).contains("Minimum number of 
items not met");
@@ -447,7 +447,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void e01_path_minLength_maxLength() throws Exception {
-               E1 x = MockRestClient.build(E.class).getRemote(E1.class);
+               E1 x = remote(E.class, E1.class);
                assertEquals("{x:'12'}", x.getX1("12"));
                assertEquals("{x:'123'}", x.getX1("123"));
                assertThrown(()->{x.getX1("1");}).contains("Minimum length of 
value not met");
@@ -502,7 +502,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void f01_path_multipleOf() throws Exception {
-               F1 x = MockRestClient.build(F.class).getRemote(F1.class);
+               F1 x = remote(F.class, F1.class);
                assertEquals("{x:'4'}", x.getX1(4));
                assertThrown(()->{x.getX1(5);}).contains("Multiple-of not met");
                assertEquals("{x:'4'}", x.getX2((short)4));
@@ -548,7 +548,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void h01_path_required() throws Exception {
-               G1 x = MockRestClient.build(G.class).getRemote(G1.class);
+               G1 x = remote(G.class, G1.class);
                assertThrown(()->{x.getX1(null);}).contains("Required value not 
provided.");
        }
 
@@ -572,7 +572,7 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void h01_path_serializer() throws Exception {
-               H1 x = MockRestClient.build(H.class).getRemote(H1.class);
+               H1 x = remote(H.class, H1.class);
                assertEquals("{x:'xXx'}", x.getX1("X"));
        }
 
@@ -627,8 +627,8 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void k01_requestBean_simpleVals() throws Exception {
-               K1 x1 = MockRestClient.build(K.class).getRemote(K1.class);
-               K1 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
+               K1 x1 = remote(K.class, K1.class);
+               K1 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
                assertEquals("a1/b1/c1//true/123", x1.getX1(new K1a()));
                assertEquals("a1/b1/c1//'true'/'123'", x2.getX1(new K1a()));
                assertEquals("xa1x/xb1x/xc1x/xx/xtruex/x123x", x2.getX2(new 
K1a()));
@@ -665,8 +665,8 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void k02_reauestBean_maps() throws Exception {
-               K2 x1 = MockRestClient.build(K.class).getRemote(K2.class);
-               K2 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
+               K2 x1 = remote(K.class, K2.class);
+               K2 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
                assertEquals("v1/123/null//true/123/null/v1/123/null/", 
x1.getX1(new K2a()));
                assertEquals("v1/123/null//'true'/'123'/'null'/v1/123/null/", 
x2.getX1(new K2a()));
                
assertEquals("xv1x/x123x/null/xx/xtruex/x123x/xnullx/xv1x/x123x/null/xx", 
x2.getX2(new K2a()));
@@ -685,15 +685,15 @@ public class Remote_PathAnnotation_Test {
        public static class K3a {
                @Path(n="*",aev=true)
                public NameValuePairs getA() {
-                       return new 
NameValuePairs().append("a1","v1").append("a2", 123).append("a3", 
null).append("a4", "");
+                       return pairs("a1","v1","a2",123,"a3",null,"a4","");
                }
                @Path("/*")
                public NameValuePairs getB() {
-                       return new 
NameValuePairs().append("b1","true").append("b2", "123").append("b3", "null");
+                       return pairs("b1","true","b2","123","b3","null");
                }
                @Path(n="*",aev=true)
                public NameValuePairs getC() {
-                       return new 
NameValuePairs().append("c1","v1").append("c2", 123).append("c3", 
null).append("c4", "");
+                       return pairs("c1","v1","c2",123,"c3",null,"c4","");
                }
                @Path("/*")
                public NameValuePairs getD() {
@@ -701,18 +701,18 @@ public class Remote_PathAnnotation_Test {
                }
                @Path(aev=true)
                public NameValuePair[] getE() {
-                       return new 
NameValuePairs().append("e1","v1").append("e2", 123).append("e3", 
null).append("e4", "").toArray(new NameValuePair[0]);
+                       return 
pairs("e1","v1","e2",123,"e3",null,"e4","").toArray(new NameValuePair[0]);
                }
                @Path(aev=true)
                public BasicNameValuePair[] getF() {
-                       return new 
NameValuePairs().append("f1","v1").append("f2", 123).append("f3", 
null).append("f4", "").toArray(new BasicNameValuePair[0]);
+                       return pairs("f1","v1","f2", 
123,"f3",null,"f4","").toArray(new BasicNameValuePair[0]);
                }
        }
 
        @Test
        public void k03_requestBean_nameValuePairs() throws Exception {
-               K3 x1 = MockRestClient.build(K.class).getRemote(K3.class);
-               K3 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
+               K3 x1 = remote(K.class, K3.class);
+               K3 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
                
assertEquals("v1/123/null//true/123/null/v1/123/null//v1/123/null//v1/123/null/",
 x1.getX1(new K3a()));
                
assertEquals("v1/123/null//true/123/null/v1/123/null//v1/123/null//v1/123/null/",
 x2.getX1(new K3a()));
                
assertEquals("v1/123/null//true/123/null/v1/123/null//v1/123/null//v1/123/null/",
 x2.getX2(new K3a()));
@@ -761,10 +761,30 @@ public class Remote_PathAnnotation_Test {
 
        @Test
        public void k04_requestBean_collections() throws Exception {
-               K4 x1 = MockRestClient.build(K.class).getRemote(K4.class);
-               K4 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K4.class);
+               K4 x1 = remote(K.class, K4.class);
+               K4 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K4.class);
                
assertEquals("foo,,true,123,null,true,123,null/foo,,true,123,null,true,123,null/foo||true|123|null|true|123|null//foo,,true,123,null,true,123,null/foo||true|123|null|true|123|null/",
 x1.getX1(new K4a()));
                
assertEquals("@(foo,'','true','123','null',true,123,null)/@(foo,'','true','123','null',true,123,null)/foo||true|123|null|true|123|null/@()/@(foo,'','true','123','null',true,123,null)/foo||true|123|null|true|123|null/@()",
 x2.getX1(new K4a()));
                
assertEquals("fooXXtrueX123XnullXtrueX123Xnull/fooXXtrueX123XnullXtrueX123Xnull/foo||true|123|null|true|123|null//fooXXtrueX123XnullXtrueX123Xnull/foo||true|123|null|true|123|null/",
 x2.getX2(new K4a()));
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static NameValuePairs pairs(Object...pairs) {
+               return NameValuePairs.of(pairs);
+       }
+
+       private static NameValuePair pair(String key, Object val) {
+               return BasicNameValuePair.of(key, val);
+       }
+
+       private static RestClientBuilder client(Class<?> c) {
+               return MockRestClient.create(c);
+       }
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_QueryAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_QueryAnnotation_Test.java
index 9c36152..256b2fb 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_QueryAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_QueryAnnotation_Test.java
@@ -92,7 +92,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void a01_objectTypes() throws Exception {
-               A1 x = MockRestClient.build(A.class).getRemote(A1.class);
+               A1 x = remote(A.class, A1.class);
                assertEquals("{x:'1'}", x.getX1(1));
                assertEquals("{x:'1.0'}", x.getX2(1));
                assertEquals("{x:'f=1'}", x.getX3(Bean.create()));
@@ -111,11 +111,11 @@ public class Remote_QueryAnnotation_Test {
                assertEquals("{x:'1'}", x.getX16(new StringReader("x=1")));
                assertEquals("{x:'1'}", x.getX17(new StringInputStream("x=1")));
                assertEquals("{x:'1'}", x.getX18(new StringInputStream("x=1")));
-               assertEquals("{foo:'bar'}", x.getX19(new 
NameValuePairs().append("foo", "bar")));
-               assertEquals("{foo:'bar'}", x.getX20(new 
NameValuePairs().append("foo", "bar")));
-               assertEquals("{foo:'bar'}", 
x.getX21(BasicNameValuePair.of("foo", "bar")));
-               assertEquals("{foo:'bar'}", x.getX22(new 
NameValuePairs().append("foo", "bar").toArray(new NameValuePair[0])));
-               assertEquals("{foo:'bar'}", x.getX23(new 
NameValuePairs().append("foo", "bar").toArray(new BasicNameValuePair[0])));
+               assertEquals("{foo:'bar'}", x.getX19(pairs("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.getX20(pairs("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.getX21(pair("foo", "bar")));
+               assertEquals("{foo:'bar'}", x.getX22(pairs("foo", 
"bar").toArray(new NameValuePair[0])));
+               assertEquals("{foo:'bar'}", x.getX23(pairs("foo", 
"bar").toArray(new BasicNameValuePair[0])));
                assertEquals("{foo:'bar'}", x.getX24("foo=bar"));
                assertEquals("{}", x.getX24(null));
        }
@@ -142,7 +142,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void b01_default_aev() throws Exception {
-               B1 x = MockRestClient.build(B.class).getRemote(B1.class);
+               B1 x = remote(B.class, B1.class);
                assertEquals("{x:'foo'}", x.getX1(null));
                assertThrown(()->{x.getX1("");}).contains("Empty value not 
allowed");
                assertEquals("{x:'foo'}", x.getX2(null));
@@ -189,7 +189,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void c01_collectionFormat() throws Exception {
-               C1 x = MockRestClient.build(C.class).getRemote(C1.class);
+               C1 x = remote(C.class, C1.class);
                assertEquals("{x:'foo,bar'}", x.getX1("foo","bar"));
                assertEquals("x=foo%2Cbar", x.getX2("foo","bar"));
                assertEquals("{x:'foo,bar'}", x.getX3("foo","bar"));
@@ -266,7 +266,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void d01_min_max_emin_emax() throws Exception {
-               D1 x = MockRestClient.build(D.class).getRemote(D1.class);
+               D1 x = remote(D.class, D1.class);
                assertEquals("{x:'1'}", x.getX1(1));
                assertEquals("{x:'10'}", x.getX1(10));
                assertThrown(()->{x.getX1(0);}).contains("Minimum value not 
met");
@@ -479,7 +479,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void e01_mini_maxi_ui() throws Exception {
-               E1 x = MockRestClient.build(E.class).getRemote(E1.class);
+               E1 x = remote(E.class, E1.class);
                assertEquals("{x:'1'}", x.getX1("1"));
                assertEquals("{x:'1|2'}", x.getX1("1","2"));
                assertThrown(()->{x.getX1();}).contains("Minimum number of 
items not met");
@@ -522,7 +522,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void f01_minl_maxl_enum() throws Exception {
-               F1 x = MockRestClient.build(F.class).getRemote(F1.class);
+               F1 x = remote(F.class, F1.class);
                assertEquals("{x:'12'}", x.getX1("12"));
                assertEquals("{x:'123'}", x.getX1("123"));
                assertThrown(()->{x.getX1("1");}).contains("Minimum length of 
value not met");
@@ -579,7 +579,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void g01_multipleOf() throws Exception {
-               G1 x = MockRestClient.build(G.class).getRemote(G1.class);
+               G1 x = remote(G.class, G1.class);
                assertEquals("{x:'4'}", x.getX1(4));
                assertThrown(()->{x.getX1(5);}).contains("Multiple-of not met");
                assertEquals("{x:'4'}", x.getX2((short)4));
@@ -631,7 +631,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void h01_required() throws Exception {
-               H1 x = MockRestClient.build(H.class).getRemote(H1.class);
+               H1 x = remote(H.class, H1.class);
                assertEquals("{}", x.getX1(null));
                assertEquals("{}", x.getX2(null));
                assertEquals("{x:'1'}", x.getX3("1"));
@@ -659,7 +659,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void i01_skipIfEmpty() throws Exception {
-               I1 x = MockRestClient.build(I.class).getRemote(I1.class);
+               I1 x = remote(I.class, I1.class);
                assertEquals("{x:''}", x.getX1(""));
                assertEquals("{x:''}", x.getX2(""));
                assertEquals("{}", x.getX3(""));
@@ -684,7 +684,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void j01_serializer() throws Exception {
-               J1 x = MockRestClient.build(J.class).getRemote(J1.class);
+               J1 x = remote(J.class, J1.class);
                assertEquals("{x:'xXx'}", x.getX1("X"));
        }
 
@@ -738,8 +738,8 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void k01_requestBean_simpleVals() throws Exception {
-               K1 x1 = MockRestClient.build(K.class).getRemote(K1.class);
-               K1 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
+               K1 x1 = remote(K.class, K1.class);
+               K1 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K1.class);
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'true',h:'123',i1:'foo'}", 
x1.getX1(new K1b()));
                
assertEquals("{a:'a1',b:'b1',c:'c1',e:'',g:'\\'true\\'',h:'\\'123\\'',i1:'foo'}",
 x2.getX1(new K1b()));
                
assertEquals("{a:'xa1x',b:'xb1x',c:'xc1x',e:'xx',g:'xtruex',h:'x123x',i1:'xfoox'}",
 x2.getX2(new K1b()));
@@ -776,8 +776,8 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void k02_requestBean_maps() throws Exception {
-               K2 x1 = MockRestClient.build(K.class).getRemote(K2.class);
-               K2 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
+               K2 x1 = remote(K.class, K2.class);
+               K2 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K2.class);
                
assertEquals("{a:'a1=v1,a2=123,a3=null,a4=',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:''}",
 x1.getX1(new K2a()));
                
assertEquals("{a:'(a1=v1,a2=123,a3=null,a4=\\'\\')',b1:'\\'true\\'',b2:'\\'123\\'',b3:'\\'null\\'',c1:'v1',c2:'123',c4:''}",
 x2.getX1(new K2a()));
                
assertEquals("{a:'x{a1:\\'v1\\',a2:123,a3:null,a4:\\'\\'}x',b1:'xtruex',b2:'x123x',b3:'xnullx',c1:'xv1x',c2:'x123x',c4:'xx'}",
 x2.getX2(new K2a()));
@@ -796,15 +796,15 @@ public class Remote_QueryAnnotation_Test {
        public static class K3a {
                @Query(aev=true)
                public NameValuePairs getA() {
-                       return new 
NameValuePairs().append("a1","v1").append("a2", 123).append("a3", 
null).append("a4", "");
+                       return pairs("a1","v1","a2",123,"a3",null,"a4","");
                }
                @Query("*")
                public NameValuePairs getB() {
-                       return new 
NameValuePairs().append("b1","true").append("b2", "123").append("b3", "null");
+                       return pairs("b1","true","b2","123","b3","null");
                }
                @Query(n="*",aev=true)
                public NameValuePairs getC() {
-                       return new 
NameValuePairs().append("c1","v1").append("c2", 123).append("c3", 
null).append("c4", "");
+                       return pairs("c1","v1","c2",123,"c3",null,"c4","");
                }
                @Query("*")
                public NameValuePairs getD() {
@@ -812,18 +812,18 @@ public class Remote_QueryAnnotation_Test {
                }
                @Query(aev=true)
                public NameValuePair[] getE() {
-                       return new 
NameValuePairs().append("e1","v1").append("e2", 123).append("e3", 
null).append("e4", "").toArray(new NameValuePair[0]);
+                       return 
pairs("e1","v1","e2",123,"e3",null,"e4","").toArray(new NameValuePair[0]);
                }
                @Query(aev=true)
                public BasicNameValuePair[] getF() {
-                       return new 
NameValuePairs().append("f1","v1").append("f2", 123).append("f3", 
null).append("f4", "").toArray(new BasicNameValuePair[0]);
+                       return pairs("f1","v1","f2", 
123,"f3",null,"f4","").toArray(new BasicNameValuePair[0]);
                }
        }
 
        @Test
        public void k03_requestBean_nameValuePairs() throws Exception {
-               K3 x1 = MockRestClient.build(K.class).getRemote(K3.class);
-               K3 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
+               K3 x1 = remote(K.class, K3.class);
+               K3 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K3.class);
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x1.getX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.getX1(new K3a()));
                
assertEquals("{a1:'v1',a2:'123',a4:'',b1:'true',b2:'123',b3:'null',c1:'v1',c2:'123',c4:'',e1:'v1',e2:'123',e4:'',f1:'v1',f2:'123',f4:''}",
 x2.getX2(new K3a()));
@@ -847,7 +847,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void k04_requestBean_charSequence() throws Exception {
-               K4 x = MockRestClient.build(K.class).getRemote(K4.class);
+               K4 x = remote(K.class, K4.class);
                assertEquals("{baz:'qux',foo:'bar'}", x.get(new K4a()));
        }
 
@@ -869,7 +869,7 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void k05_requestBean_reader() throws Exception {
-               K5 x = MockRestClient.build(K.class).getRemote(K5.class);
+               K5 x = remote(K.class, K5.class);
                assertEquals("{baz:'qux',foo:'bar'}", x.get(new K5a()));
        }
 
@@ -924,10 +924,30 @@ public class Remote_QueryAnnotation_Test {
 
        @Test
        public void k06_requestBean_collections() throws Exception {
-               K6 x1 = MockRestClient.build(K.class).getRemote(K6.class);
-               K6 x2 = 
MockRestClient.create(K.class).partSerializer(UonSerializer.class).build().getRemote(K6.class);
+               K6 x1 = remote(K.class, K6.class);
+               K6 x2 = 
client(K.class).partSerializer(UonSerializer.class).build().getRemote(K6.class);
                
assertEquals("{a:'foo,,true,123,null,true,123,null',b:'foo,,true,123,null,true,123,null',c:'foo||true|123|null|true|123|null',d:'',f:'foo,,true,123,null,true,123,null',g:'foo||true|123|null|true|123|null',h:''}",
 x1.getX1(new K6a()));
                
assertEquals("{a:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',b:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',c:'foo||true|123|null|true|123|null',d:'@()',f:'@(foo,\\'\\',\\'true\\',\\'123\\',\\'null\\',true,123,null)',g:'foo||true|123|null|true|123|null',h:'@()'}",
 x2.getX1(new K6a()));
                
assertEquals("{a:'fooXXtrueX123XnullXtrueX123Xnull',b:'fooXXtrueX123XnullXtrueX123Xnull',c:'foo||true|123|null|true|123|null',d:'',f:'fooXXtrueX123XnullXtrueX123Xnull',g:'foo||true|123|null|true|123|null',h:''}",
 x2.getX2(new K6a()));
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static NameValuePairs pairs(Object...pairs) {
+               return NameValuePairs.of(pairs);
+       }
+
+       private static NameValuePair pair(String key, Object val) {
+               return BasicNameValuePair.of(key, val);
+       }
+
+       private static RestClientBuilder client(Class<?> c) {
+               return MockRestClient.create(c);
+       }
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RemoteMethodAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RemoteMethodAnnotation_Test.java
index 1b6fe79..1e6bc26 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RemoteMethodAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RemoteMethodAnnotation_Test.java
@@ -66,7 +66,7 @@ public class Remote_RemoteMethodAnnotation_Test {
 
        @Test
        public void a01_inferredMethodsAndPaths() throws Exception {
-               A1 t = MockRestClient.build(A.class).getRemote(A1.class);
+               A1 t = remote(A.class, A1.class);
                assertEquals("foo", t.doGet());
                assertEquals("foo", t.doGET());
                assertEquals("qux", t.doFoo());
@@ -85,7 +85,7 @@ public class Remote_RemoteMethodAnnotation_Test {
 
        @Test
        public void a02_inferredMethodsAndPaths_futures() throws Exception {
-               A2 t = MockRestClient.build(A.class).getRemote(A2.class);
+               A2 t = remote(A.class, A2.class);
                assertEquals("foo", t.doGet().get());
                assertEquals("foo", t.doGET().get());
                assertEquals("qux", t.doFoo().get());
@@ -104,7 +104,7 @@ public class Remote_RemoteMethodAnnotation_Test {
 
        @Test
        public void a03_inferredMethodsAndPaths_completableFutures() throws 
Exception {
-               A3 t = MockRestClient.build(A.class).getRemote(A3.class);
+               A3 t = remote(A.class, A3.class);
                assertEquals("foo", t.doGet().get());
                assertEquals("foo", t.doGET().get());
                assertEquals("qux", t.doFoo().get());
@@ -145,7 +145,7 @@ public class Remote_RemoteMethodAnnotation_Test {
 
        @Test
        public void b01_returnTypes() throws Exception {
-               B1 x = MockRestClient.build(B.class).getRemote(B1.class);
+               B1 x = remote(B.class, B1.class);
                x.x1();
                assertEquals("foo", x.x2());
                assertEquals("foo", 
IOUtils.read(x.x3().getEntity().getContent()));
@@ -238,7 +238,7 @@ public class Remote_RemoteMethodAnnotation_Test {
 
        @Test
        public void d01_returnTypes_partSerialization() throws Exception {
-               D1 x = 
MockRestClient.create(D.class).openApi().build().getRemote(D1.class);
+               D1 x = client(D.class).openApi().build().getRemote(D1.class);
                assertEquals("foo", x.postX1("foo"));
                assertEquals("foo", 
IOUtils.read(x.postX2("foo").getEntity().getContent()));
                assertEquals("foo", IOUtils.read(x.postX3("foo")));
@@ -252,4 +252,16 @@ public class Remote_RemoteMethodAnnotation_Test {
                assertEquals("foo", IOUtils.read(x.postX11("foo").get()));
                assertEquals("foo", IOUtils.read(x.postX12("foo").get()));
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static RestClientBuilder client(Class<?> c) {
+               return MockRestClient.create(c).simpleJson();
+       }
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RequestAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RequestAnnotation_Test.java
index bb07583..49e8a99 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RequestAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_RequestAnnotation_Test.java
@@ -77,7 +77,7 @@ public class Remote_RequestAnnotation_Test {
 
        @Test
        public void a01_basic() throws Exception {
-               A2 x = MockRestClient.build(A.class).getRemote(A2.class);
+               A2 x = remote(A.class, A2.class);
                assertEquals("{body:'foo',header:'x',query:'x',path:'x'}", 
x.post(new A1()));
                assertEquals("{body:'',header:null,query:null,path:'{x}'}", 
x.post(null));
        }
@@ -133,7 +133,7 @@ public class Remote_RequestAnnotation_Test {
 
        @Test
        public void b01_annotationOnParent() throws Exception {
-               B3 x = MockRestClient.build(B.class).getRemote(B3.class);
+               B3 x = remote(B.class, B3.class);
                assertEquals("{body:'foo',header:'x',query:'x',path:'x'}", 
x.post(new B2()));
                assertEquals("{body:'',header:null,query:null,path:'{x}'}", 
x.post(null));
        }
@@ -189,7 +189,7 @@ public class Remote_RequestAnnotation_Test {
 
        @Test
        public void c01_annotationOnInterface() throws Exception {
-               C3 x = MockRestClient.build(C.class).getRemote(C3.class);
+               C3 x = remote(C.class, C3.class);
                assertEquals("{body:'foo',header:'x',query:'x',path:'x'}", 
x.post(new C2()));
                assertEquals("{body:'',header:null,query:null,path:'{x}'}", 
x.post(null));
        }
@@ -237,7 +237,7 @@ public class Remote_RequestAnnotation_Test {
 
        @Test
        public void d01_annotationOnParameter() throws Exception {
-               D2 x = MockRestClient.build(D.class).getRemote(D2.class);
+               D2 x = remote(D.class, D2.class);
                assertEquals("{body:'foo',header:'x',query:'x',path:'x'}", 
x.post(new D1()));
                assertEquals("{body:'',header:null,query:null,path:'{x}'}", 
x.post(null));
        }
@@ -286,8 +286,16 @@ public class Remote_RequestAnnotation_Test {
 
        @Test
        public void e01_partSerializer() throws Exception {
-               E2 x = MockRestClient.build(E.class).getRemote(E2.class);
+               E2 x = remote(E.class, E2.class);
                
assertEquals("{body:'foo',header:'xxx',query:'xxx',path:'xxx'}", x.post(new 
E1()));
                assertEquals("{body:'',header:null,query:null,path:'{x}'}", 
x.post(null));
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_ResponseAnnotation_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_ResponseAnnotation_Test.java
index d3f808d..4be0a35 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_ResponseAnnotation_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/Remote_ResponseAnnotation_Test.java
@@ -57,9 +57,17 @@ public class Remote_ResponseAnnotation_Test {
 
        @Test
        public void a01_basic() throws Exception {
-               A1 x = MockRestClient.build(A.class).getRemote(A2.class).get();
+               A1 x = remote(A.class, A2.class).get();
                assertEquals("foo", IOUtils.read(x.getBody()));
                assertEquals("x", x.getHeader());
                assertEquals(201, x.getStatus());
        }
+
+       
//------------------------------------------------------------------------------------------------------------------
+       // Helper methods.
+       
//------------------------------------------------------------------------------------------------------------------
+
+       private static <T> T remote(Class<?> rest, Class<T> t) {
+               return MockRestClient.build(rest).getRemote(t);
+       }
 }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_FormData_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_FormData_Test.java
index b4b4c8c..9173ba8 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_FormData_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_FormData_Test.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.httppart.HttpPartSchema.*;
 import static org.apache.juneau.AddFlag.*;
 
 import java.io.*;
+import java.util.*;
 
 import org.apache.http.*;
 import org.apache.juneau.collections.*;
@@ -45,113 +46,117 @@ public class RestClient_FormData_Test {
 
        @Test
        public void a01_formData() throws Exception {
-               client().formData("Foo","bar").formData("Foo",new 
StringBuilder("baz")).build().post("/formData").run().assertBody().is("Foo=bar&Foo=baz");
-               
client().build().post("/formData").formData("Foo","bar").formData("Foo",new 
StringBuilder("baz")).run().assertBody().is("Foo=bar&Foo=baz");
+               client().formData("foo","bar").formData("foo",new 
StringBuilder("baz")).build().post("/formData").run().assertBody().is("foo=bar&foo=baz");
+               
client().build().post("/formData").formData("foo","bar").formData("foo",new 
StringBuilder("baz")).run().assertBody().is("foo=bar&foo=baz");
+
+               client().formData(pair("foo", 
"bar")).build().post("/formData").formData(pair("foo", 
"baz")).run().assertBody().is("foo=bar&foo=baz");
+
+               client().formData(pair("foo", 
"bar")).build().post("/formData").formData(APPEND,"foo","baz").run().assertBody().is("foo=bar&foo=baz");
+               client().formData(pair("foo", 
"bar")).build().post("/formData").formData(PREPEND,"foo","baz").run().assertBody().is("foo=baz&foo=bar");
+               client().formData(pair("foo", 
"bar")).build().post("/formData").formData(REPLACE,"foo","baz").run().assertBody().is("foo=baz");
        }
 
        @Test
        public void a02_formDatas() throws Exception {
-               
client().formDatas(pair("Foo","f1")).formDatas(OMap.of("Foo","f2")).formDatas(AMap.of("Foo","f3")).formDatas(pairs("Foo","f4","Foo","f5")).formDatas(pair("Foo","f6"),
 pair("Foo","f7")).formDatas((Object)new 
NameValuePair[]{pair("Foo","f8")}).build().post("/formData").run().assertBody().is("Foo=f1&Foo=f2&Foo=f3&Foo=f4&Foo=f5&Foo=f6&Foo=f7&Foo=f8");
-               
client().build().post("/formData").formDatas(pair("Foo","f1")).formDatas(OMap.of("Foo","f2")).formDatas(AMap.of("Foo","f3")).formDatas(pairs("Foo","f4","Foo","f5")).formDatas(pair("Foo","f6"),
 pair("Foo","f7")).formDatas((Object)new 
NameValuePair[]{pair("Foo","f8")}).run().assertBody().is("Foo=f1&Foo=f2&Foo=f3&Foo=f4&Foo=f5&Foo=f6&Foo=f7&Foo=f8");
+               
client().formDatas(pair("foo","bar")).build().post("/formData").run().assertBody().is("foo=bar");
+               
client().formDatas(OMap.of("foo","bar")).build().post("/formData").run().assertBody().is("foo=bar");
+               
client().formDatas(AMap.of("foo","bar")).build().post("/formData").run().assertBody().is("foo=bar");
+               
client().formDatas(pairs("foo","bar","foo","baz")).build().post("/formData").run().assertBody().is("foo=bar&foo=baz");
+               client().formDatas(pair("foo","bar"), 
pair("foo","baz")).build().post("/formData").run().assertBody().is("foo=bar&foo=baz");
+               client().formDatas((Object)new 
NameValuePair[]{pair("foo","bar")}).build().post("/formData").run().assertBody().is("foo=bar");
+
+               
client().build().post("/formData").formDatas(pair("foo","bar")).run().assertBody().is("foo=bar");
+               
client().build().post("/formData").formDatas(OMap.of("foo","bar")).run().assertBody().is("foo=bar");
+               
client().build().post("/formData").formDatas(AMap.of("foo","bar")).run().assertBody().is("foo=bar");
+               
client().build().post("/formData").formDatas(pairs("foo","bar","foo","baz")).run().assertBody().is("foo=bar&foo=baz");
+               client().build().post("/formData").formDatas(pair("foo","bar"), 
pair("foo","baz")).run().assertBody().is("foo=bar&foo=baz");
+               client().build().post("/formData").formDatas((Object)new 
NameValuePair[]{pair("foo","bar")}).run().assertBody().is("foo=bar");
+
+               
client().build().post("/formData").formDatas(ABean.get()).run().assertBody().is("f=1");
+
+               client().formDatas(pair("foo","bar"), 
null).build().post("/formData").run().assertBody().is("foo=bar");
+               client().build().post("/formData").formDatas(pair("foo","bar"), 
null).run().assertBody().is("foo=bar");
+               
client().formDatas(pair("foo",null)).build().post("/formData").run().assertBody().is("");
+               
client().formDatas(pair(null,"foo")).build().post("/formData").run().assertBody().is("null=foo");
+               
client().formDatas(pair(null,null)).build().post("/formData").run().assertBody().is("");
+
+               
client().build().post("/formData").formDatas(pair("foo",null)).run().assertBody().is("");
+               
client().build().post("/formData").formDatas(pair(null,"foo")).run().assertBody().is("null=foo");
+               
client().build().post("/formData").formDatas(pair(null,null)).run().assertBody().is("");
+
+               
client().formDatas(SerializedHeader.create().name("foo").value("bar")).build().post("/formData").run().assertBody().is("foo=bar");
+
+               
assertThrown(()->{client().build().post("/formData").formDatas("bad");}).is("Invalid
 type passed to formDatas(): java.lang.String");
+               assertThrown(()->{client().formDatas(pair("foo","bar"), 
"baz");}).is("Invalid type passed to formData():  java.lang.String");
        }
 
        @Test
-       public void a03_formData_withSchema() throws Exception {
-               client().formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().post("/formData").run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
-               
client().build().post("/formData").formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
-
-               client().formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().post("/formData").formData("Foo",AList.of("qux","quux"), 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz&Foo=qux%7Cquux").assertBody().urlDecodedIs("Foo=bar|baz&Foo=qux|quux");
-               client().formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().post("/formData").formData(APPEND,"Foo",AList.of("qux","quux"),
 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz&Foo=qux%7Cquux").assertBody().urlDecodedIs("Foo=bar|baz&Foo=qux|quux");
-               client().formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().post("/formData").formData(PREPEND,"Foo",AList.of("qux","quux"),
 
T_ARRAY_PIPES).run().assertBody().is("Foo=qux%7Cquux&Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=qux|quux&Foo=bar|baz");
-               client().formData("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().post("/formData").formData(REPLACE,"Foo",AList.of("qux","quux"),
 
T_ARRAY_PIPES).run().assertBody().is("Foo=qux%7Cquux").assertBody().urlDecodedIs("Foo=qux|quux");
+       public void a03_formDataPairs() throws Exception {
+               List<String> l1 = AList.of("bar1","bar2"), l2 = 
AList.of("qux1","qux2");
+
+               
client().formDataPairs("foo","bar","baz","qux").build().post("/formData").run().assertBody().is("foo=bar&baz=qux");
+               
client().formDataPairs("foo",l1,"baz",l2).build().post("/formData").run().assertBody().urlDecode().is("foo=bar1,bar2&baz=qux1,qux2");
+
+               
client().build().post("/formData").formDataPairs("foo","bar","baz","qux").run().assertBody().is("foo=bar&baz=qux");
+               
client().build().post("/formData").formDataPairs("foo",l1,"baz",l2).run().assertBody().urlDecode().is("foo=bar1,bar2&baz=qux1,qux2");
+
+               
assertThrown(()->{client().formDataPairs("foo","bar","baz");}).is("Odd number 
of parameters passed into formDataPairs()");
+               
assertThrown(()->{client().build().post("").formDataPairs("foo","bar","baz");}).is("Odd
 number of parameters passed into formDataPairs()");
        }
 
        @Test
-       public void a03_formData_withSchemaAndSerializer() throws Exception {
-               client().formData("Foo",AList.of("bar","baz"), T_ARRAY_PIPES, 
UonSerializer.DEFAULT).build().post("/formData").run().assertBody().urlDecodedIs("Foo=@(bar,baz)");
+       public void a04_formData_withSchema() throws Exception {
+               List<String> l1 = AList.of("bar","baz"), l2 = 
AList.of("qux","quux");
+
+               client().formData("foo",l1, 
T_ARRAY_PIPES).build().post("/formData").run().assertBody().urlDecode().is("foo=bar|baz");
+               client().build().post("/formData").formData("foo",l1, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=bar|baz");
+
+               client().formData("foo",l1, 
T_ARRAY_PIPES).build().post("/formData").formData("foo",l2, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=bar|baz&foo=qux|quux");
+               client().formData("foo",l1, 
T_ARRAY_PIPES).build().post("/formData").formData(APPEND,"foo",l2, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=bar|baz&foo=qux|quux");
+               client().formData("foo",l1, 
T_ARRAY_PIPES).build().post("/formData").formData(PREPEND,"foo",l2, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=qux|quux&foo=bar|baz");
+               client().formData("foo",l1, 
T_ARRAY_PIPES).build().post("/formData").formData(REPLACE,"foo",l2, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=qux|quux");
+
+               client().formData("foo",l1, T_ARRAY_PIPES, 
UonSerializer.DEFAULT).build().post("/formData").run().assertBody().urlDecode().is("foo=@(bar,baz)");
        }
 
        @Test
-       public void a04_formData_withSupplier() throws Exception {
+       public void a05_formData_withSupplier() throws Exception {
                TestSupplier s = TestSupplier.of(null);
 
-               RestClient x1 = client().formData("Foo", s).build();
+               RestClient x1 = client().formData("foo", s).build();
                s.set(OList.of("foo","bar"));
-               
x1.post("/formData").run().assertBody().is("Foo=foo%2Cbar").assertBody().urlDecodedIs("Foo=foo,bar");
+               
x1.post("/formData").run().assertBody().is("foo=foo%2Cbar").assertBody().urlDecode().is("foo=foo,bar");
                s.set(OList.of("bar","baz"));
-               
x1.post("/formData").run().assertBody().is("Foo=bar%2Cbaz").assertBody().urlDecodedIs("Foo=bar,baz");
+               
x1.post("/formData").run().assertBody().is("foo=bar%2Cbaz").assertBody().urlDecode().is("foo=bar,baz");
 
                RestClient x2 = client().build();
                s.set(OList.of("foo","bar"));
-               x2.post("/formData").formData("Foo", 
s).run().assertBody().is("Foo=foo%2Cbar").assertBody().urlDecodedIs("Foo=foo,bar");
+               x2.post("/formData").formData("foo", 
s).run().assertBody().is("foo=foo%2Cbar").assertBody().urlDecode().is("foo=foo,bar");
                s.set(OList.of("bar","baz"));
-               x2.post("/formData").formData("Foo", 
s).run().assertBody().is("Foo=bar%2Cbaz").assertBody().urlDecodedIs("Foo=bar,baz");
-       }
+               x2.post("/formData").formData("foo", 
s).run().assertBody().is("foo=bar%2Cbaz").assertBody().urlDecode().is("foo=bar,baz");
 
-       @Test
-       public void a05_formData_withSupplierAndSerializer() throws Exception {
-               TestSupplier s = TestSupplier.of(OList.of("foo","bar"));
-               RestClient x = client().formData("Foo", s, T_ARRAY_PIPES, new 
K12a()).build();
-               
x.post("/formData").run().assertBody().is("Foo=x%5B%27foo%27%2C%27bar%27%5D").assertBody().urlDecodedIs("Foo=x['foo','bar']");
+               s = TestSupplier.of(OList.of("foo","bar"));
+               RestClient x = client().formData("foo", s, T_ARRAY_PIPES, new 
K12a()).build();
+               
x.post("/formData").run().assertBody().is("foo=x%5B%27foo%27%2C%27bar%27%5D").assertBody().urlDecode().is("foo=x['foo','bar']");
                s.set(OList.of("bar","baz"));
-               
x.post("/formData").run().assertBody().is("Foo=x%5B%27bar%27%2C%27baz%27%5D").assertBody().urlDecodedIs("Foo=x['bar','baz']");
+               
x.post("/formData").run().assertBody().is("foo=x%5B%27bar%27%2C%27baz%27%5D").assertBody().urlDecode().is("foo=x['bar','baz']");
        }
 
        @Test
        public void a06_formData_withSupplierAndSchema() throws Exception {
                TestSupplier s = TestSupplier.of(null);
 
-               RestClient x1 = client().formData("Foo", s, 
T_ARRAY_PIPES).build();
+               RestClient x1 = client().formData("foo", s, 
T_ARRAY_PIPES).build();
                s.set(AList.of("foo","bar"));
-               
x1.post("/formData").run().assertBody().is("Foo=foo%7Cbar").assertBody().urlDecodedIs("Foo=foo|bar");
+               
x1.post("/formData").run().assertBody().is("foo=foo%7Cbar").assertBody().urlDecode().is("foo=foo|bar");
                s.set(AList.of("bar","baz"));
-               
x1.post("/formData").run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
+               
x1.post("/formData").run().assertBody().is("foo=bar%7Cbaz").assertBody().urlDecode().is("foo=bar|baz");
 
                RestClient x2 = client().build();
                s.set(AList.of("foo","bar"));
-               x2.post("/formData").formData("Foo", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=foo%7Cbar").assertBody().urlDecodedIs("Foo=foo|bar");
+               x2.post("/formData").formData("foo", s, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=foo|bar");
                s.set(AList.of("bar","baz"));
-               x2.post("/formData").formData("Foo", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
-       }
-
-       @Test
-       public void a07_formDatas_withNulls() throws Exception {
-               client().formDatas(pair("Foo","bar"), 
null).build().post("/formData").run().assertBody().is("Foo=bar");
-               client().build().post("/formData").formDatas(pair("Foo","bar"), 
null).run().assertBody().is("Foo=bar");
-
-               
client().formDatas(pair("Foo",null)).build().post("/formData").run().assertBody().is("");
-               
client().formDatas(pair(null,"Foo")).build().post("/formData").run().assertBody().is("null=Foo");
-               
client().formDatas(pair(null,null)).build().post("/formData").run().assertBody().is("");
-
-               
client().build().post("/formData").formDatas(pair("Foo",null)).run().assertBody().is("");
-               
client().build().post("/formData").formDatas(pair(null,"Foo")).run().assertBody().is("null=Foo");
-               
client().build().post("/formData").formDatas(pair(null,null)).run().assertBody().is("");
-       }
-
-       @Test
-       public void a08_formDatas_invalid() throws Exception {
-               assertThrown(()->{client().formDatas(pair("Foo","bar"), 
"Baz");}).is("Invalid type passed to formData():  java.lang.String");
-       }
-
-       @Test
-       public void a09_formDataPairs() throws Exception {
-               
client().formDataPairs("foo","bar","baz","qux").build().post("/formData").run().assertBody().is("foo=bar&baz=qux");
-               
client().formDataPairs("foo",AList.of("bar1","bar2"),"baz",AList.of("qux1","qux2")).build().post("/formData").run().assertBody().is("foo=bar1%2Cbar2&baz=qux1%2Cqux2").assertBody().urlDecodedIs("foo=bar1,bar2&baz=qux1,qux2");
-       }
-
-       @Test
-       public void a10_formDataPairs_invalid() throws Exception {
-               
assertThrown(()->{client().formDataPairs("foo","bar","baz");}).is("Odd number 
of parameters passed into formDataPairs(Object...)");
-       }
-
-       @Test
-       public void a11_formDatas_serializedHeaderBuilder() throws Exception {
-               
client().formDatas(SerializedHeader.create().name("foo").value("bar")).build().post("/formData").run().assertBody().is("foo=bar");
-       }
-
-       @Test
-       public void a12_formData_NameValuePair() throws Exception {
-               client().formData(pair("foo", 
"bar")).build().post("/formData").formData(pair("foo", 
"baz")).run().assertBody().is("foo=bar&foo=baz");
+               x2.post("/formData").formData("foo", s, 
T_ARRAY_PIPES).run().assertBody().urlDecode().is("foo=bar|baz");
        }
 
        
//------------------------------------------------------------------------------------------------------------------
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Query_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Query_Test.java
index d2ceaf3..2c04880 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Query_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Query_Test.java
@@ -63,39 +63,39 @@ public class RestClient_Query_Test {
 
        @Test
        public void a03_query_withSchema() throws Exception {
-               client().query("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().get("/query").run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
+               client().query("Foo",AList.of("bar","baz"), 
T_ARRAY_PIPES).build().get("/query").run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecode().is("Foo=bar|baz");
        }
 
        @Test
        public void a04_query_withSchemaAndSerializer() throws Exception {
-               client().query("Foo",AList.of("bar","baz"), T_ARRAY_PIPES, 
UonSerializer.DEFAULT).build().get("/query").run().assertBody().is("Foo=%40%28bar%2Cbaz%29").assertBody().urlDecodedIs("Foo=@(bar,baz)");
+               client().query("Foo",AList.of("bar","baz"), T_ARRAY_PIPES, 
UonSerializer.DEFAULT).build().get("/query").run().assertBody().is("Foo=%40%28bar%2Cbaz%29").assertBody().urlDecode().is("Foo=@(bar,baz)");
        }
 
        @Test
        public void a05_query_withSchemaAndSupplier() throws Exception {
                TestSupplier s = TestSupplier.of(AList.of("foo","bar"));
                RestClient x = client().query("Foo", s, T_ARRAY_PIPES).build();
-               x.get("/query").query("Bar", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=foo%7Cbar&Bar=foo%7Cbar").assertBody().urlDecodedIs("Foo=foo|bar&Bar=foo|bar");
+               x.get("/query").query("Bar", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=foo%7Cbar&Bar=foo%7Cbar").assertBody().urlDecode().is("Foo=foo|bar&Bar=foo|bar");
                s.set(new String[]{"bar","baz"});
-               x.get("/query").query("Bar", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz&Bar=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz&Bar=bar|baz");
+               x.get("/query").query("Bar", s, 
T_ARRAY_PIPES).run().assertBody().is("Foo=bar%7Cbaz&Bar=bar%7Cbaz").assertBody().urlDecode().is("Foo=bar|baz&Bar=bar|baz");
        }
 
        @Test
        public void a06_query_withSchemaAndSupplierAndSerializer() throws 
Exception {
                TestSupplier s = TestSupplier.of(AList.of("foo","bar"));
                RestClient x = client().query("Foo", s, T_ARRAY_PIPES, new 
K12a()).build();
-               
x.get("/query").run().assertBody().is("Foo=x%5B%27foo%27%2C%27bar%27%5D").assertBody().urlDecodedIs("Foo=x['foo','bar']");
+               
x.get("/query").run().assertBody().is("Foo=x%5B%27foo%27%2C%27bar%27%5D").assertBody().urlDecode().is("Foo=x['foo','bar']");
                s.set(AList.of("bar","baz"));
-               
x.get("/query").run().assertBody().is("Foo=x%5B%27bar%27%2C%27baz%27%5D").assertBody().urlDecodedIs("Foo=x['bar','baz']");
+               
x.get("/query").run().assertBody().is("Foo=x%5B%27bar%27%2C%27baz%27%5D").assertBody().urlDecode().is("Foo=x['bar','baz']");
        }
 
        @Test
        public void a07_query_withSupplier() throws Exception {
                TestSupplier s = TestSupplier.of(AList.of("foo","bar"));
                RestClient x = client().query("Foo", s).build();
-               
x.get("/query").run().assertBody().is("Foo=foo%2Cbar").assertBody().urlDecodedIs("Foo=foo,bar");
+               
x.get("/query").run().assertBody().is("Foo=foo%2Cbar").assertBody().urlDecode().is("Foo=foo,bar");
                s.set(AList.of("bar","baz"));
-               
x.get("/query").run().assertBody().is("Foo=bar%2Cbaz").assertBody().urlDecodedIs("Foo=bar,baz");
+               
x.get("/query").run().assertBody().is("Foo=bar%2Cbaz").assertBody().urlDecode().is("Foo=bar,baz");
        }
 
        @Test
@@ -107,8 +107,8 @@ public class RestClient_Query_Test {
        public void a09_queryPairs() throws Exception {
                
client().queryPairs("foo","bar","baz","qux").build().get("/query").run().assertBody().is("foo=bar&baz=qux");
                
client().build().get("/query").queryPairs("foo","bar","baz","qux").run().assertBody().is("foo=bar&baz=qux");
-               
client().queryPairs("foo",AList.of("bar1","bar2"),"baz",AList.of("qux1","qux2")).build().get("/query").run().assertBody().is("foo=bar1%2Cbar2&baz=qux1%2Cqux2").assertBody().urlDecodedIs("foo=bar1,bar2&baz=qux1,qux2");
-               
client().build().get("/query").queryPairs("foo",AList.of("bar1","bar2"),"baz",AList.of("qux1","qux2")).run().assertBody().is("foo=bar1%2Cbar2&baz=qux1%2Cqux2").assertBody().urlDecodedIs("foo=bar1,bar2&baz=qux1,qux2");
+               
client().queryPairs("foo",AList.of("bar1","bar2"),"baz",AList.of("qux1","qux2")).build().get("/query").run().assertBody().is("foo=bar1%2Cbar2&baz=qux1%2Cqux2").assertBody().urlDecode().is("foo=bar1,bar2&baz=qux1,qux2");
+               
client().build().get("/query").queryPairs("foo",AList.of("bar1","bar2"),"baz",AList.of("qux1","qux2")).run().assertBody().is("foo=bar1%2Cbar2&baz=qux1%2Cqux2").assertBody().urlDecode().is("foo=bar1,bar2&baz=qux1,qux2");
                
assertThrown(()->{client().queryPairs("foo","bar","baz");}).contains("Odd 
number of parameters");
                
assertThrown(()->{client().build().get().queryPairs("foo","bar","baz");}).contains("Odd
 number of parameters");
        }
diff --git 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Test.java
 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Test.java
index 2fdb047..0fb3ab4 100644
--- 
a/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Test.java
+++ 
b/juneau-rest/juneau-rest-client-utest/src/test/java/org/apache/juneau/rest/client2/RestClient_Test.java
@@ -1410,14 +1410,14 @@ public class RestClient_Test {
 
        @Test
        public void n01_openApi_oapiFormat() throws Exception {
-               
MockRestClient.create(A.class).oapiFormat(HttpPartFormat.UON).build().get("/checkQuery").query("Foo",
 "bar 
baz").run().assertBody().is("Foo=%27bar+baz%27").assertBody().urlDecodedIs("Foo='bar
 baz'");
+               
MockRestClient.create(A.class).oapiFormat(HttpPartFormat.UON).build().get("/checkQuery").query("Foo",
 "bar 
baz").run().assertBody().is("Foo=%27bar+baz%27").assertBody().urlDecode().is("Foo='bar
 baz'");
        }
 
        @Test
        public void n02_openApi_oapiCollectionFormat() throws Exception {
                RestClient x = 
MockRestClient.create(A.class).oapiCollectionFormat(HttpPartCollectionFormat.PIPES).build();
-               x.get("/checkQuery").query("Foo", new 
String[]{"bar","baz"}).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
-               x.post("/checkFormData").formData("Foo", new 
String[]{"bar","baz"}).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecodedIs("Foo=bar|baz");
+               x.get("/checkQuery").query("Foo", new 
String[]{"bar","baz"}).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecode().is("Foo=bar|baz");
+               x.post("/checkFormData").formData("Foo", new 
String[]{"bar","baz"}).run().assertBody().is("Foo=bar%7Cbaz").assertBody().urlDecode().is("Foo=bar|baz");
                x.get("/checkHeader").header("Check", "Foo").header("Foo", new 
String[]{"bar","baz"}).accept("text/json+simple").run().assertBody().is("['bar|baz']");
        }
 
@@ -1451,9 +1451,9 @@ public class RestClient_Test {
                x1.post("/echoBody", new O1()).run().assertBody().is("'O1'");
                x2.post("/echoBody", new O1()).run().assertBody().is("{f:1}");
                x1.get("/checkQuery").query("foo", new 
O1()).run().assertBody().is("foo=O1");
-               x2.get("/checkQuery").query("foo", new 
O1()).run().assertBody().is("foo=f%3D1").assertBody().urlDecodedIs("foo=f=1");
+               x2.get("/checkQuery").query("foo", new 
O1()).run().assertBody().is("foo=f%3D1").assertBody().urlDecode().is("foo=f=1");
                x1.formPost("/checkFormData").formData("foo", new 
O1()).run().assertBody().is("foo=O1");
-               x2.formPost("/checkFormData").formData("foo", new 
O1()).run().assertBody().is("foo=f%3D1").assertBody().urlDecodedIs("foo=f=1");
+               x2.formPost("/checkFormData").formData("foo", new 
O1()).run().assertBody().is("foo=f%3D1").assertBody().urlDecode().is("foo=f=1");
                x1.get("/checkHeader").header("foo", new O1()).header("Check", 
"foo").run().assertBody().is("['O1']");
                x2.get("/checkHeader").header("foo", new O1()).header("Check", 
"foo").run().assertBody().is("['f=1']");
        }
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client2/RestClientBuilder.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client2/RestClientBuilder.java
index 57e988d..708f8c6 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client2/RestClientBuilder.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client2/RestClientBuilder.java
@@ -2395,7 +2395,7 @@ public class RestClientBuilder extends BeanContextBuilder 
{
        @FluentSetter
        public RestClientBuilder formDataPairs(Object...pairs) {
                if (pairs.length % 2 != 0)
-                       throw new RuntimeException("Odd number of parameters 
passed into formDataPairs(Object...)");
+                       throw new RuntimeException("Odd number of parameters 
passed into formDataPairs()");
                for (int i = 0; i < pairs.length; i+=2)
                        formDatas(serializedNameValuePair(pairs[i], pairs[i+1], 
FORMDATA, null, null));
                return this;

Reply via email to