http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/DefaultContentTypesTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/DefaultContentTypesTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/DefaultContentTypesTest.java
new file mode 100644
index 0000000..a508ee2
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/DefaultContentTypesTest.java
@@ -0,0 +1,497 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.junit.Assert.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+
+public class DefaultContentTypesTest {
+
+       private static String URL = "/testDefaultContentTypes";
+       private static boolean debug = false;
+
+       
//====================================================================================================
+       // Test that default Accept and Content-Type headers on servlet 
annotation are picked up.
+       
//====================================================================================================
+       @Test
+       public void testDefaultHeadersOnServletAnnotation() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String r;
+
+               String url = URL + "/testDefaultHeadersOnServletAnnotation";
+
+               client.setAccept("").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s1").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p2", r);
+
+               client.setAccept("").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p1", r);
+
+               client.setAccept("text/s1").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.setAccept("text/s2").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s2").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               try {
+                       client.setAccept("text/s3").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s3'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p3");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p3'",
+                               "Supported media-types: [text/p1, text/p2]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s3").setContentType("text/p3");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p3'",
+                               "Supported media-types: [text/p1, text/p2]"
+                       );
+               }
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test that default Accept and Content-Type headers on servlet 
annotation are picked up
+       // when @RestMethod.parsers/serializers annotations are used.
+       
//====================================================================================================
+       @Test
+       public void testRestMethodParsersSerializers() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String r;
+
+               String url = URL + "/testRestMethodParsersSerializers";
+
+               try {
+                       client.setAccept("").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s1").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p1");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p1'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s1").setContentType("text/p1");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p1'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s2").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p2");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s2").setContentType("text/p2");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s3").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p3");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s2'",
+                               "Supported media-types: [text/s3]"
+                       );
+               }
+
+               client.setAccept("text/s3").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test that default Accept and Content-Type headers on servlet 
annotation are picked up
+       // when @RestMethod.addParsers/addSerializers annotations are used.
+       
//====================================================================================================
+       @Test
+       public void testRestMethodAddParsersSerializers() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String r;
+
+               String url = URL + "/testRestMethodAddParsersSerializers";
+
+               client.setAccept("").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s1").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p2", r);
+
+               client.setAccept("").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p1", r);
+
+               client.setAccept("text/s1").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.setAccept("text/s2").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s2").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s3").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p2", r);
+
+               client.setAccept("").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p3", r);
+
+               client.setAccept("text/s3").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               try {
+                       client.setAccept("").setContentType("text/p4");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       // Note that parsers defined on method are listed 
before parsers defined on class.
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p4'",
+                               "Supported media-types: [text/p3, text/p1, 
text/p2]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s4").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       // Note that serializers defined on method are listed 
before serializers defined on class.
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s4'",
+                               "Supported media-types: [text/s3, text/s1, 
text/s2]"
+                       );
+               }
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Various Accept incantations.
+       
//====================================================================================================
+       @Test
+       public void testAccept() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT).setContentType("text/p1");
+               String r;
+
+               String url = URL + "/testAccept";
+
+               // "*/*" should match the first serializer, not the default 
serializer.
+               client.setAccept("*/*");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               // "text/*" should match the first serializer, not the default 
serializer.
+               client.setAccept("text/*");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               try {
+                       client.setAccept("bad/*");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'bad/*'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               client.setAccept("bad/*,text/*");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.setAccept("text/*,bad/*");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.setAccept("text/s1;q=0.5,text/s2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p1", r);
+
+               client.setAccept("text/s1,text/s2;q=0.5");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test that default Accept and Content-Type headers on method 
annotation are picked up
+       // when @RestMethod.parsers/serializers annotations are used.
+       
//====================================================================================================
+       @Test
+       public void testRestMethodParserSerializerAnnotations() throws 
Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String r;
+
+               String url = URL + "/testRestMethodParserSerializerAnnotations";
+
+               client.setAccept("").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               try {
+                       client.setAccept("text/s1").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s1'",
+                               "Supported media-types: [text/s3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p1");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p1'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s1").setContentType("text/p1");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p1'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s2").setContentType("");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s2'",
+                               "Supported media-types: [text/s3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("").setContentType("text/p2");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s2").setContentType("text/p2");
+                       r = client.doPut(url+"?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p2'",
+                               "Supported media-types: [text/p3]"
+                       );
+               }
+
+               client.setAccept("text/s3").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.setAccept("").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.setAccept("text/s3").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test that default Accept and Content-Type headers on method 
annotation are picked up
+       //      when @RestMethod.addParsers/addSerializers annotations are used.
+       
//====================================================================================================
+       @Test
+       public void testRestMethodAddParsersSerializersAnnotations() throws 
Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String r;
+
+               String url = URL + 
"/testRestMethodAddParsersSerializersAnnotations";
+
+               client.setAccept("").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.setAccept("text/s1").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p3", r);
+
+               client.setAccept("").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p1", r);
+
+               client.setAccept("text/s1").setContentType("text/p1");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s1/p1", r);
+
+               client.setAccept("text/s2").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p3", r);
+
+               client.setAccept("").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p2", r);
+
+               client.setAccept("text/s2").setContentType("text/p2");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s2/p2", r);
+
+               client.setAccept("text/s3").setContentType("");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.setAccept("").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.setAccept("text/s3").setContentType("text/p3");
+               r = client.doPut(url, "").getResponseAsString();
+               assertEquals("s3/p3", r);
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ErrorConditionsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ErrorConditionsTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ErrorConditionsTest.java
new file mode 100644
index 0000000..46d0f69
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/ErrorConditionsTest.java
@@ -0,0 +1,219 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.junit.Assert.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+
+public class ErrorConditionsTest {
+
+       private static String URL = "/testErrorConditions";
+       private static boolean debug = false;
+       private static RestClient client;
+
+       @BeforeClass
+       public static void beforeClass() {
+                client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+       }
+
+       @AfterClass
+       public static void afterClass() {
+                client.closeQuietly();
+       }
+       
//====================================================================================================
+       // Test non-existent properties
+       
//====================================================================================================
+       @Test
+       public void testNonExistentBeanProperties() throws Exception {
+               String url = URL + "/testNonExistentBeanProperties";
+
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f2:'foo'}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert request body content to 
class type 'org.apache.juneau.rest.test.ErrorConditionsResource$Test1' using 
parser 'org.apache.juneau.json.JsonParser'",
+                               "Unknown property 'f2' encountered while trying 
to parse into class 
'org.apache.juneau.rest.test.ErrorConditionsResource$Test1'");
+               }
+
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f1:'foo', f2:'foo'}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert request body content to 
class type 'org.apache.juneau.rest.test.ErrorConditionsResource$Test1' using 
parser 'org.apache.juneau.json.JsonParser'",
+                               "Unknown property 'f2' encountered while trying 
to parse into class 
'org.apache.juneau.rest.test.ErrorConditionsResource$Test1'");
+               }
+       }
+
+       
//====================================================================================================
+       // Test trying to set properties to wrong data type
+       
//====================================================================================================
+       @Test
+       public void testWrongDataType() throws Exception {
+               String url = URL + "/testWrongDataType";
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f1:'foo'}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Invalid number");
+               }
+       }
+
+       
//====================================================================================================
+       // Test trying to parse into class with non-public no-arg constructor.
+       
//====================================================================================================
+       @Test
+       public void testParseIntoNonConstructableBean() throws Exception {
+               String url = URL + "/testParseIntoNonConstructableBean";
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f1:1}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Class 
'org.apache.juneau.rest.test.ErrorConditionsResource$Test3a' could not be 
instantiated.");
+               }
+       }
+
+       
//====================================================================================================
+       // Test trying to parse into non-static inner class
+       
//====================================================================================================
+       @Test
+       public void testParseIntoNonStaticInnerClass() throws Exception {
+               String url = URL + "/testParseIntoNonStaticInnerClass";
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f1:1}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Class 
'org.apache.juneau.rest.test.ErrorConditionsResource$Test3b' could not be 
instantiated.  Reason: 'No properties detected on bean class'");
+               }
+       }
+
+       
//====================================================================================================
+       // Test trying to parse into non-public inner class
+       
//====================================================================================================
+       @Test
+       public void testParseIntoNonPublicInnerClass() throws Exception {
+               String url = URL + "/testParseIntoNonPublicInnerClass";
+               try {
+                       client.doPut(url + "?noTrace=true", new 
ObjectMap("{f1:1}")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Class 
'org.apache.juneau.rest.test.ErrorConditionsResource$Test3b1' could not be 
instantiated",
+                               "Class is not public");
+               }
+       }
+
+       
//====================================================================================================
+       // Test exception thrown during bean construction.
+       
//====================================================================================================
+       @Test
+       public void testThrownConstructorException() throws Exception {
+               String url = URL + "/testThrownConstructorException";
+               try {
+                       client.doPut(url + "?noTrace=true", 
"'foo'").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert request body content to 
class type 'org.apache.juneau.rest.test.ErrorConditionsResource$Test3c' using 
parser 'org.apache.juneau.json.JsonParser'.",
+                               "Caused by (RuntimeException): Test error");
+               }
+       }
+
+       
//====================================================================================================
+       // Test trying to set parameters to invalid types.
+       
//====================================================================================================
+       @Test
+       public void testSetParameterToInvalidTypes() throws Exception {
+               String url = URL + "/testSetParameterToInvalidTypes";
+               try {
+                       client.doPut(url + "/1?noTrace=true&p1=foo", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert QUERY 'p1' to type 'int' on 
method 
'org.apache.juneau.rest.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
+               }
+
+               try {
+                       client.doPut(url + "/foo?noTrace=true&p1=1", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert PATH 'a1' to type 'int' on 
method 
'org.apache.juneau.rest.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
+               }
+
+               try {
+                       client.doPut(url + "/1?noTrace=true&p1=1", 
"").setHeader("h1", "foo").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Could not convert HEADER 'h1' to type 'int' on 
method 
'org.apache.juneau.rest.test.ErrorConditionsResource.testSetParameterToInvalidTypes'");
+               }
+       }
+
+       
//====================================================================================================
+       // Test SC_NOT_FOUND & SC_METHOD_NOT_ALLOWED
+       
//====================================================================================================
+       @Test
+       public void test404and405() throws Exception {
+               String url = URL + "/test404and405";
+               try {
+                       client.doGet(URL + 
"/testNonExistent?noTrace=true").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_FOUND,
+                               "Method 'GET' not found on resource with 
matching pattern on path '/testNonExistent'");
+               }
+
+               try {
+                       client.doPut(url + "?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_FOUND,
+                               "Method 'PUT' not found on resource with 
matching pattern on path '/test404and405'");
+               }
+
+               try {
+                       client.doPost(url + "?noTrace=true", 
"").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_METHOD_NOT_ALLOWED,
+                               "Method 'POST' not found on resource.");
+               }
+       }
+
+       
//====================================================================================================
+       // Test SC_PRECONDITION_FAILED
+       
//====================================================================================================
+       @Test
+       public void test412() throws Exception {
+               String url = URL + "/test412";
+               try {
+                       client.doGet(url + 
"?noTrace=true").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_PRECONDITION_FAILED,
+                               "Method 'GET' not found on resource on path 
'/test412' with matching matcher.");
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GroupsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GroupsTest.java 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GroupsTest.java
new file mode 100644
index 0000000..f28f051
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GroupsTest.java
@@ -0,0 +1,122 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.junit.Assert.*;
+
+import java.io.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+
+public class GroupsTest {
+
+       private static String URL = "/testGroups";
+       private static boolean debug = false;
+
+       
//====================================================================================================
+       // Serializer defined on class.
+       
//====================================================================================================
+       @Test
+       public void testSerializerDefinedOnClass() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+               String url = URL + "/testSerializerDefinedOnClass";
+               String r;
+
+               try {
+                       client.setContentType("text/p1");
+                       r = 
client.doGet(url+"?noTrace=true").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'application/json'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               client.setAccept("text/s1").setContentType("");
+               r = client.doGet(url).getResponseAsString();
+               assertEquals("text/s,GET", r);
+
+               client.setAccept("text/s2").setContentType("");
+               r = client.doGet(url).getResponseAsString();
+               assertEquals("text/s,GET", r);
+
+               try {
+                       client.setAccept("text/s3").setContentType("");
+                       r = 
client.doGet(url+"?noTrace=true").getResponseAsString();
+                       assertEquals("text/s,GET", r);
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s3'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/json").setContentType("text/p1");
+                       r = client.doPut(url+"?noTrace=true", new 
StringReader("foo")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/json'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               try {
+                       client.setAccept("text/s1").setContentType("text/json");
+                       r = client.doPut(url+"?noTrace=true", new 
StringReader("foo")).getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/json'",
+                               "Supported media-types: [text/p1, text/p2]"
+                       );
+               }
+
+               client.setContentType("text/p1").setAccept("text/s1");
+               r = client.doPut(url, new 
StringReader("foo")).getResponseAsString();
+               assertEquals("text/s,foo", r);
+
+               client.setContentType("text/p2").setAccept("text/s2");
+               r = client.doPut(url, new 
StringReader("foo")).getResponseAsString();
+               assertEquals("text/s,foo", r);
+
+               try {
+                       client.setContentType("text/p1").setAccept("text/s3");
+                       r = client.doPut(url+"?noTrace=true", new 
StringReader("foo")).getResponseAsString();
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported media-type in request header 
'Accept': 'text/s3'",
+                               "Supported media-types: [text/s1, text/s2]"
+                       );
+               }
+
+               try {
+                       client.setContentType("text/p3").setAccept("text/s1");
+                       r = client.doPut(url+"?noTrace=true", new 
StringReader("foo")).getResponseAsString();
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported media-type in request header 
'Content-Type': 'text/p3'",
+                               "Supported media-types: [text/p1, text/p2]"
+                       );
+               }
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
new file mode 100644
index 0000000..22e4fda
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/GzipTest.java
@@ -0,0 +1,344 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.util.zip.*;
+
+import org.apache.http.impl.client.*;
+import org.apache.juneau.internal.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+/**
+ * Test Accept-Encoding and Content-Encoding handling.
+ *
+ * Note:  WAS does automatic gzip decompression on http request messages, so 
we have to invent
+ *     our own 'mycoding' compression.
+ */
+public class GzipTest {
+
+       private static boolean debug = false;
+
+       private static String testGzipOff = "/testGzipOff";
+       private static String testGzipOn = "/testGzipOn";
+
+       // Converts string into a GZipped input stream.
+       private static InputStream compress(String contents) throws Exception {
+               ByteArrayOutputStream baos = new 
ByteArrayOutputStream(contents.length()>>1);
+               GZIPOutputStream gos = new GZIPOutputStream(baos);
+               gos.write(contents.getBytes());
+               gos.finish();
+               gos.close();
+               return new ByteArrayInputStream(baos.toByteArray());
+       }
+
+       private static String decompress(InputStream is) throws Exception {
+               return IOUtils.read(new GZIPInputStream(is));
+       }
+
+       
//====================================================================================================
+       // Test with no compression enabled.
+       
//====================================================================================================
+       @Test
+       public void testGzipOff() throws Exception {
+               RestClient c = new 
TestRestClient().setAccept("text/plain").setContentType("text/plain");
+               RestCall r;
+               String url = testGzipOff;
+
+               // *** GET ***
+
+               r = c.doGet(url);
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "*");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "identity");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match identity.
+               r = c.doGet(url).setHeader("Accept-Encoding", "mycoding");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Shouldn't match.
+               try {
+                       r = 
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"mycoding,identity;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'mycoding,identity;q=0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               // Shouldn't match.
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"mycoding,*;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'mycoding,*;q=0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"identity;q=0.8,mycoding;q=0.6");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding;q=0.8,identity;q=0.6");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding;q=0.8,*;q=0.6");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"*;q=0.8,myencoding;q=0.6");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"identity;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'identity;q=0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"identity;q=0.0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'identity;q=0.0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", "*;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': '*;q=0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", "*;q=0.0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': '*;q=0.0'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+
+               // *** PUT ***
+
+               r = c.doPut(url, new StringReader("foo"));
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doPut(url, new 
StringReader("foo")).setHeader("Content-Encoding", "");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doPut(url, new 
StringReader("foo")).setHeader("Content-Encoding", "identity");
+               assertEquals("foo", r.getResponseAsString());
+
+               try {
+                       c.doPut(url+"?noTrace=true", 
compress("foo")).setHeader("Content-Encoding", "mycoding").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_UNSUPPORTED_MEDIA_TYPE,
+                               "Unsupported encoding in request header 
'Content-Encoding': 'mycoding'",
+                               "Supported codings: [identity]"
+                       );
+               }
+
+               c.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test with compression enabled.
+       
//====================================================================================================
+       @Test
+       public void testGzipOn() throws Exception {
+
+               // Create a client that disables content compression support so 
that we can get the gzipped content directly.
+               CloseableHttpClient httpClient = 
HttpClients.custom().setSSLSocketFactory(TestRestClient.getSSLSocketFactory()).disableContentCompression().build();
+
+               RestClient c = new 
TestRestClient(httpClient).setAccept("text/plain").setContentType("text/plain");
+               RestCall r;
+               String url = testGzipOn;
+
+               // *** GET ***
+
+               r = c.doGet(url);
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "*");
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               r = c.doGet(url).setHeader("Accept-Encoding", "identity");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match identity.
+               r = c.doGet(url).setHeader("Accept-Encoding", "mycoding");
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding,identity;q=0").connect();
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding,*;q=0").connect();
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"identity;q=0.8,mycoding;q=0.6");
+               assertEquals("foo", r.getResponseAsString());
+
+               // Should match mycoding
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding;q=0.8,identity;q=0.6");
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               // Should match mycoding
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"mycoding;q=0.8,*;q=0.6");
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               // Should match identity
+               r = c.doGet(url).setHeader("Accept-Encoding", 
"*;q=0.8,myencoding;q=0.6");
+               assertEquals("foo", decompress(r.getInputStream()));
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"identity;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'identity;q=0'",
+                               "Supported codings: [mycoding, identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", 
"identity;q=0.0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': 'identity;q=0.0'",
+                               "Supported codings: [mycoding, identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", "*;q=0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': '*;q=0'",
+                               "Supported codings: [mycoding, identity]"
+                       );
+               }
+
+               // Shouldn't match
+               try {
+                       
c.doGet(url+"?noTrace=true").setHeader("Accept-Encoding", "*;q=0.0").connect();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_NOT_ACCEPTABLE,
+                               "Unsupported encoding in request header 
'Accept-Encoding': '*;q=0.0'",
+                               "Supported codings: [mycoding, identity]"
+                       );
+               }
+
+
+               // *** PUT ***
+
+               r = c.doPut(url, new StringReader("foo"));
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doPut(url, new 
StringReader("foo")).setHeader("Content-Encoding", "");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doPut(url, new 
StringReader("foo")).setHeader("Content-Encoding", "identity");
+               assertEquals("foo", r.getResponseAsString());
+
+               r = c.doPut(url, compress("foo")).setHeader("Content-Encoding", 
"mycoding");
+               assertEquals("foo", r.getResponseAsString());
+
+               c.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test with compression enabled but with servlet using output stream 
directly.
+       
//====================================================================================================
+       @Test
+       public void testGzipOnDirect() throws Exception {
+               // Create a client that disables content compression support so 
that we can get the gzipped content directly.
+               CloseableHttpClient httpClient = 
HttpClientBuilder.create().setSSLSocketFactory(TestRestClient.getSSLSocketFactory()).build();
+               RestClient c = new 
TestRestClient(httpClient).setAccept("text/plain").setContentType("text/plain");
+               RestCall r = null;
+               String s = null;
+
+               // res.getOutputStream() called....should bypass encoding.
+               r = c.doGet(testGzipOn + 
"/direct").setHeader("Accept-Encoding", "mycoding");
+               s = r.getResponseAsString();
+               assertEquals("test", s);
+               
assertTrue(r.getResponse().getHeaders("Content-Type")[0].getValue().contains("text/direct"));
 // Should get header set manually.
+               assertEquals(0, 
r.getResponse().getHeaders("Content-Encoding").length);                // 
Should not be set.
+
+               // res.getWriter() called....should bypass encoding.
+               r = c.doGet(testGzipOn + 
"/direct2").setHeader("Accept-Encoding", "mycoding");
+               s = r.getResponseAsString();
+               assertEquals("test", s);
+               assertEquals(0, 
r.getResponse().getHeaders("Content-Encoding").length);                // 
Should not be set.
+
+               // res.getNegotiateWriter() called....should NOT bypass 
encoding.
+               r = c.doGet(testGzipOn + 
"/direct3").setHeader("Accept-Encoding", "mycoding");
+               try {
+                       assertEquals("mycoding", 
r.getResponse().getHeaders("content-encoding")[0].getValue());
+               } catch (RestCallException e) {
+                       // OK - HttpClient doesn't know what mycoding is.
+                       // Newer versions of HttpClient ignore this condition.
+               }
+
+               // res.getNegotiateWriter() called but 
@RestMethod(encoders={})...should bypass encoding.
+               r = c.doGet(testGzipOn + 
"/direct4").setHeader("Accept-Encoding", "mycoding");
+               s = r.getResponseAsString();
+               assertEquals("test", s);
+               assertEquals(0, 
r.getResponse().getHeaders("Content-Encoding").length);                // 
Should not be set.
+
+               c.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InheritanceTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InheritanceTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InheritanceTest.java
new file mode 100644
index 0000000..93500c7
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/InheritanceTest.java
@@ -0,0 +1,126 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+public class InheritanceTest {
+
+       private static RestClient client;
+
+       @BeforeClass
+       public static void beforeClass() {
+               client = new TestRestClient();
+       }
+
+       @AfterClass
+       public static void afterClass() {
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test serializer inheritance.
+       
//====================================================================================================
+       @Test
+       public void testSerializers() throws Exception {
+               String r;
+               String url = "/testInheritanceSerializers";
+               r = client.doGet(url + "/test1").getResponseAsString();
+               assertEquals("['text/s3','text/s4','text/s1','text/s2']", r);
+
+               r = client.doGet(url + "/test2").getResponseAsString();
+               assertEquals("['text/s5']", r);
+
+               r = client.doGet(url + "/test3").getResponseAsString();
+               
assertEquals("['text/s5','text/s3','text/s4','text/s1','text/s2']", r);
+       }
+
+       
//====================================================================================================
+       // Test parser inheritance.
+       
//====================================================================================================
+       @Test
+       public void testParsers() throws Exception {
+               String r;
+               String url = "/testInheritanceParsers";
+               r = client.doGet(url + "/test1").getResponseAsString();
+               assertEquals("['text/p3','text/p4','text/p1','text/p2']", r);
+
+               r = client.doGet(url + "/test2").getResponseAsString();
+               assertEquals("['text/p5']", r);
+
+               r = client.doGet(url + "/test3").getResponseAsString();
+               
assertEquals("['text/p5','text/p3','text/p4','text/p1','text/p2']", r);
+       }
+
+       
//====================================================================================================
+       // Test encoder inheritance.
+       
//====================================================================================================
+       @Test
+       public void testEncoders() throws Exception {
+               String url = "/testInheritanceEncoders";
+               String r = client.doGet(url + "/test").getResponseAsString();
+               assertEquals("['e3','e4','e1','e2','identity']", r);
+       }
+
+       
//====================================================================================================
+       // Test filter inheritance.
+       
//====================================================================================================
+       @Test
+       public void testTransforms() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.class, 
JsonParser.class).setAccept("text/json+simple");
+               String r;
+               String url = "/testInheritanceTransforms";
+
+               r = client.doGet(url + "/test1").getResponseAsString();
+               assertEquals("['F1','F2','Foo3']", r);
+
+               r = client.doGet(url + "/test2").getResponseAsString();
+               assertEquals("['F1','F2','F3']", r);
+
+               r = client.doGet(url + "/test3").getResponseAsString();
+               assertEquals("['F1','F2','F3']", r);
+
+               r = client.doGet(url + "/test4").getResponseAsString();
+               assertEquals("['Foo1','Foo2','F3']", r);
+
+               r = client.doGet(url + "/test5").getResponseAsString();
+               assertEquals("['F1','F2','F3']", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test properties inheritance.
+       
//====================================================================================================
+       @Test
+       public void testProperties() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.class, 
JsonParser.class).setAccept("text/json+simple");
+               String r;
+               String url = "/testInheritanceProperties";
+
+               r = client.doGet(url + "/test1").getResponseAsString();
+               assertEquals("{p1:'v1',p2:'v2a',p3:'v3',p4:'v4'}", r);
+
+               r = client.doGet(url + "/test2?override").getResponseAsString();
+               assertEquals("{p1:'x',p2:'x',p3:'x',p4:'x',p5:'x'}", r);
+
+               r = client.doGet(url + "/test2").getResponseAsString();
+               assertEquals("{p1:'v1',p2:'v2a',p3:'v3',p4:'v4a',p5:'v5'}", r);
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/JacocoDummyTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/JacocoDummyTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/JacocoDummyTest.java
new file mode 100644
index 0000000..c1496ce
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/JacocoDummyTest.java
@@ -0,0 +1,38 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import java.lang.reflect.*;
+
+import org.apache.juneau.rest.*;
+import org.junit.*;
+
+public class JacocoDummyTest {
+
+       
//====================================================================================================
+       // Dummy code to add test coverage in Jacoco.
+       
//====================================================================================================
+       @Test
+       public void accessPrivateConstructorsOnStaticUtilityClasses() throws 
Exception {
+
+               Class<?>[] classes = new Class[] {
+                       RestUtils.class
+               };
+
+               for (Class<?> c : classes) {
+                       Constructor<?> c1 = c.getDeclaredConstructor();
+                       c1.setAccessible(true);
+                       c1.newInstance();
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/LargePojosTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/LargePojosTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/LargePojosTest.java
new file mode 100644
index 0000000..7c140c6
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/LargePojosTest.java
@@ -0,0 +1,84 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import org.apache.juneau.html.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.apache.juneau.rest.test.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+@Ignore
+public class LargePojosTest {
+
+       private static String URL = "/testLargePojos";
+       boolean debug = false;
+
+       
//====================================================================================================
+       // Test how long it takes to serialize/parse various content types.
+       
//====================================================================================================
+       @Test
+       public void test() throws Exception {
+               LargePojo p;
+               long t;
+               RestClient c;
+
+               System.err.println("\n---Testing JSON---");
+               c = new TestRestClient(JsonSerializer.class, JsonParser.class);
+               for (int i = 1; i <= 3; i++) {
+                       t = System.currentTimeMillis();
+                       p = c.doGet(URL).getResponse(LargePojo.class);
+                       System.err.println("Download: 
["+(System.currentTimeMillis() - t)+"] ms");
+                       t = System.currentTimeMillis();
+                       c.doPut(URL, p).run();
+                       System.err.println("Upload: 
["+(System.currentTimeMillis() - t)+"] ms");
+               }
+
+               System.err.println("\n---Testing XML---");
+               c = new TestRestClient(XmlSerializer.class, XmlParser.class);
+               for (int i = 1; i <= 3; i++) {
+                       t = System.currentTimeMillis();
+                       p = c.doGet(URL).getResponse(LargePojo.class);
+                       System.err.println("Download: 
["+(System.currentTimeMillis() - t)+"] ms");
+                       t = System.currentTimeMillis();
+                       c.doPut(URL, p).run();
+                       System.err.println("Upload: 
["+(System.currentTimeMillis() - t)+"] ms");
+               }
+
+               System.err.println("\n---Testing HTML---");
+               c = new TestRestClient(HtmlSerializer.class, 
HtmlParser.class).setAccept("text/html+stripped");
+               for (int i = 1; i <= 3; i++) {
+                       t = System.currentTimeMillis();
+                       p = c.doGet(URL).getResponse(LargePojo.class);
+                       System.err.println("Download: 
["+(System.currentTimeMillis() - t)+"] ms");
+                       t = System.currentTimeMillis();
+                       c.doPut(URL, p).run();
+                       System.err.println("Upload: 
["+(System.currentTimeMillis() - t)+"] ms");
+               }
+
+               System.err.println("\n---Testing UrlEncoding---");
+               c = new TestRestClient(UonSerializer.class, UonParser.class);
+               for (int i = 1; i <= 3; i++) {
+                       t = System.currentTimeMillis();
+                       p = c.doGet(URL).getResponse(LargePojo.class);
+                       System.err.println("Download: 
["+(System.currentTimeMillis() - t)+"] ms");
+                       t = System.currentTimeMillis();
+                       c.doPut(URL, p).run();
+                       System.err.println("Upload: 
["+(System.currentTimeMillis() - t)+"] ms");
+               }
+
+               c.closeQuietly();
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/MessagesTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/MessagesTest.java 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/MessagesTest.java
new file mode 100644
index 0000000..7201784
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/MessagesTest.java
@@ -0,0 +1,47 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.apache.juneau.rest.test.TestUtils.*;
+
+import java.util.*;
+
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+/**
+ * Validates that resource bundles can be defined on both parent and child 
classes.
+ */
+public class MessagesTest {
+
+       
//====================================================================================================
+       // Return contents of resource bundle.
+       
//====================================================================================================
+       @SuppressWarnings("rawtypes")
+       @Test
+       public void test() throws Exception {
+               RestClient client = new 
TestRestClient(JsonSerializer.class,JsonParser.class);
+
+               // Parent resource should just pick up values from its bundle.
+               TreeMap r = 
client.doGet("/testMessages/test").getResponse(TreeMap.class);
+               assertObjectEquals("{key1:'value1a',key2:'value2a'}", r);
+
+               // Child resource should pick up values from both parent and 
child,
+               // ordered child before parent.
+               r = 
client.doGet("/testMessages2/test").getResponse(TreeMap.class);
+               
assertObjectEquals("{key1:'value1a',key2:'value2b',key3:'value3b'}", r);
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsPropertyTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsPropertyTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsPropertyTest.java
new file mode 100644
index 0000000..770eaf9
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsPropertyTest.java
@@ -0,0 +1,48 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.plaintext.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+public class NlsPropertyTest {
+
+       private static String URL = "/testNlsProperty";
+
+       
//====================================================================================================
+       // Test getting an NLS property defined on a class.
+       
//====================================================================================================
+       @Test
+       public void testInheritedFromClass() throws Exception {
+               RestClient client = new 
TestRestClient(PlainTextSerializer.class, PlainTextParser.class);
+               String r = client.doGet(URL + 
"/testInheritedFromClass").getResponseAsString();
+               assertEquals("value1", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // Test getting an NLS property defined on a method.
+       
//====================================================================================================
+       @Test
+       public void testInheritedFromMethod() throws Exception {
+               RestClient client = new 
TestRestClient(PlainTextSerializer.class, PlainTextParser.class);
+               String r = client.doGet(URL + 
"/testInheritedFromMethod").getResponseAsString();
+               assertEquals("value2", r);
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsTest.java 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsTest.java
new file mode 100644
index 0000000..3013a10
--- /dev/null
+++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NlsTest.java
@@ -0,0 +1,115 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static org.apache.juneau.rest.test.TestUtils.*;
+
+import org.apache.juneau.dto.swagger.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+public class NlsTest {
+
+       private static String URL = "/testNls";
+
+       // 
====================================================================================================
+       // test1 - Pull labels from annotations only.
+       // 
====================================================================================================
+       @Test
+       public void test1() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test1").getResponse(Swagger.class);
+               assertObjectEquals("{title:'Test1.a',description:'Test1.b'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'Test1.f'},{'in':'header',name:'D',type:'string',description:'Test1.g'},{'in':'header',name:'D2',type:'string',description:'Test1.j'},{'in':'header',name:'g'},{'in':'path',name:'a',type:'string',description:'Test1.d',required:true},{'in':'path',name:'a2',type:'string',description:'Test1.h',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',type:'string',description:'Test1.e'},{'in':'query',name:'b2',type:'string',description:'Test1.i'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'OK'},'201':{description:'Test1.l',headers:{bar:{description:'Test1.m',type:'string'}}}}",
 s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+
+       // 
====================================================================================================
+       // test2 - Pull labels from resource bundles only - simple keys.
+       // 
====================================================================================================
+       @Test
+       public void test2() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test2").getResponse(Swagger.class);
+               assertObjectEquals("{title:'Test2.a',description:'Test2.b'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'Test2.f'},{'in':'header',name:'D',description:'Test2.g'},{'in':'header',name:'D2',description:'Test2.j'},{'in':'header',name:'g'},{'in':'path',name:'a',description:'Test2.d',required:true},{'in':'path',name:'a2',description:'Test2.h',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',description:'Test2.e'},{'in':'query',name:'b2',description:'Test2.i'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'OK2'},'201':{description:'Test2.l'}}", 
s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+
+       // 
====================================================================================================
+       // test3 - Pull labels from resource bundles only - keys with class 
names.
+       // 
====================================================================================================
+       @Test
+       public void test3() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test3").getResponse(Swagger.class);
+               assertObjectEquals("{title:'Test3.a',description:'Test3.b'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'Test3.f'},{'in':'header',name:'D',description:'Test3.g'},{'in':'header',name:'D2',description:'Test3.j'},{'in':'header',name:'g'},{'in':'path',name:'a',description:'Test3.d',required:true},{'in':'path',name:'a2',description:'Test3.h',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',description:'Test3.e'},{'in':'query',name:'b2',description:'Test3.i'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'OK3'},'201':{description:'Test3.l'}}", 
s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+
+       // 
====================================================================================================
+       // test4 - Pull labels from resource bundles only. Values have 
localized variables to resolve.
+       // 
====================================================================================================
+       @Test
+       public void test4() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test4").getResponse(Swagger.class);
+               assertObjectEquals("{title:'baz',description:'baz'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'baz'},{'in':'header',name:'D',description:'baz'},{'in':'header',name:'D2',description:'baz'},{'in':'header',name:'g'},{'in':'path',name:'a',description:'baz',required:true},{'in':'path',name:'a2',description:'baz',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',description:'baz'},{'in':'query',name:'b2',description:'baz'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'foobazfoobazfoo'},'201':{description:'baz'}}",
 s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+
+       // 
====================================================================================================
+       // test5 - Pull labels from resource bundles only. Values have request 
variables to resolve.
+       // 
====================================================================================================
+       @Test
+       public void test5() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test5").getResponse(Swagger.class);
+               assertObjectEquals("{title:'baz2',description:'baz2'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'baz2'},{'in':'header',name:'D',description:'baz2'},{'in':'header',name:'D2',description:'baz2'},{'in':'header',name:'g'},{'in':'path',name:'a',description:'baz2',required:true},{'in':'path',name:'a2',description:'baz2',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',description:'baz2'},{'in':'query',name:'b2',description:'baz2'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'foobaz2foobaz2foo'},'201':{description:'baz2'}}",
 s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+
+       // 
====================================================================================================
+       // test6 - Pull labels from annotations only, but annotations contain 
variables.
+       // 
====================================================================================================
+       @Test
+       public void test6() throws Exception {
+               RestClient client = new TestRestClient(JsonSerializer.DEFAULT, 
JsonParser.DEFAULT);
+
+               Swagger s = client.doOptions(URL + 
"/test6").getResponse(Swagger.class);
+               assertObjectEquals("{title:'baz',description:'baz'}", 
s.getInfo());
+               
assertObjectEquals("[{'in':'body',description:'baz'},{'in':'header',name:'D',type:'string',description:'baz'},{'in':'header',name:'D2',type:'string',description:'baz'},{'in':'header',name:'g'},{'in':'path',name:'a',type:'string',description:'baz',required:true},{'in':'path',name:'a2',type:'string',description:'baz',required:true},{'in':'path',name:'e',required:true},{'in':'query',name:'b',type:'string',description:'baz'},{'in':'query',name:'b2',type:'string',description:'baz'},{'in':'query',name:'f'}]",
 s.getPaths().get("/{a}").get("post").getParameters());
+               
assertObjectEquals("{'200':{description:'OK'},'201':{description:'baz',headers:{bar:{description:'baz',type:'string'}}}}",
 s.getPaths().get("/{a}").get("post").getResponses());
+
+               client.closeQuietly();
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NoParserInputTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NoParserInputTest.java
 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NoParserInputTest.java
new file mode 100644
index 0000000..7219d05
--- /dev/null
+++ 
b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/NoParserInputTest.java
@@ -0,0 +1,70 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
+package org.apache.juneau.rest.test;
+
+import static javax.servlet.http.HttpServletResponse.*;
+import static org.apache.juneau.rest.test.TestUtils.*;
+import static org.junit.Assert.*;
+
+import org.apache.juneau.plaintext.*;
+import org.apache.juneau.rest.client.*;
+import org.junit.*;
+
+public class NoParserInputTest {
+
+       private static String URL = "/testNoParserInput";
+       private static boolean debug = false;
+
+       
//====================================================================================================
+       // @Body annotated InputStream.
+       
//====================================================================================================
+       @Test
+       public void testInputStream() throws Exception {
+               RestClient client = new 
TestRestClient(PlainTextSerializer.class, PlainTextParser.class);
+               String r = client.doPut(URL + "/testInputStream", 
"foo").getResponseAsString();
+               assertEquals("foo", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // @Body annotated Reader.
+       
//====================================================================================================
+       @Test
+       public void testReader() throws Exception {
+               RestClient client = new 
TestRestClient(PlainTextSerializer.class, PlainTextParser.class);
+               String r = client.doPut(URL + "/testReader", 
"foo").getResponseAsString();
+               assertEquals("foo", r);
+
+               client.closeQuietly();
+       }
+
+       
//====================================================================================================
+       // @Body annotated PushbackReader.
+       // This should always fail since the servlet reader is not a pushback 
reader.
+       
//====================================================================================================
+       @Test
+       public void testPushbackReader() throws Exception {
+               RestClient client = new 
TestRestClient(PlainTextSerializer.class, PlainTextParser.class);
+               try {
+                       client.doPut(URL + "/testPushbackReader?noTrace=true", 
"foo").getResponseAsString();
+                       fail("Exception expected");
+               } catch (RestCallException e) {
+                       checkErrorResponse(debug, e, SC_BAD_REQUEST,
+                               "Invalid argument type passed to the following 
method:",
+                               "'public java.lang.String 
org.apache.juneau.rest.test.NoParserInputResource.testPushbackReader(java.io.PushbackReader)
 throws java.lang.Exception'");
+               }
+
+               client.closeQuietly();
+       }
+}

Reply via email to