More JUnits, bug fixes.

Project: http://git-wip-us.apache.org/repos/asf/incubator-juneau/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-juneau/commit/bde9b101
Tree: http://git-wip-us.apache.org/repos/asf/incubator-juneau/tree/bde9b101
Diff: http://git-wip-us.apache.org/repos/asf/incubator-juneau/diff/bde9b101

Branch: refs/heads/master
Commit: bde9b10152cd9249e6f453eafe8a9aaff45839c1
Parents: 2ca845c
Author: JamesBognar <[email protected]>
Authored: Fri Apr 7 14:19:20 2017 -0400
Committer: JamesBognar <[email protected]>
Committed: Fri Apr 7 14:19:35 2017 -0400

----------------------------------------------------------------------
 .../org/apache/juneau/jena/RdfSerializer.java   |    2 +-
 .../juneau/jena/RdfSerializerBuilder.java       |    7 +
 .../test/java/org/apache/juneau/ComboInput.java |   89 +
 .../test/java/org/apache/juneau/ComboTest.java  |  370 +-
 .../test/java/org/apache/juneau/TestUtils.java  |   35 +-
 .../apache/juneau/dto/html5/Html5ComboTest.java | 4681 ++++++++++--------
 .../dto/html5/Html5TemplateComboTest.java       |   80 +-
 .../org/apache/juneau/html/BasicHtmlTest.java   | 3771 +++++++++-----
 .../apache/juneau/jena/CommonParserTest.java    |   10 +-
 .../org/apache/juneau/jena/RdfParserTest.java   |   54 +-
 .../java/org/apache/juneau/jena/RdfTest.java    |  548 +-
 .../transforms/BeanDictionaryComboTest.java     |  965 +++-
 .../ByteArrayBase64SwapComboTest.java           |  641 +--
 .../transforms/CalendarSwapComboTest.java       | 1077 ++--
 .../juneau/transforms/DateSwapComboTest.java    | 1075 ++--
 .../org/apache/juneau/utils/PojoQueryTest.java  |    2 +-
 .../org/apache/juneau/xml/BasicXmlTest.java     |   14 +-
 .../java/org/apache/juneau/xml/XmlTest.java     |    4 +-
 .../java/org/apache/juneau/BeanContext.java     |   41 +-
 .../apache/juneau/csv/CsvSerializerBuilder.java |    7 +
 .../juneau/dto/html5/HtmlElementContainer.java  |   27 +
 .../juneau/dto/html5/HtmlElementMixed.java      |   27 +
 .../org/apache/juneau/html/HtmlSerializer.java  |   15 +-
 .../juneau/html/HtmlSerializerBuilder.java      |    6 +
 .../apache/juneau/jso/JsoSerializerBuilder.java |    6 +
 .../juneau/json/JsonSchemaSerializer.java       |    4 +-
 .../json/JsonSchemaSerializerBuilder.java       |    7 +
 .../org/apache/juneau/json/JsonSerializer.java  |    2 +-
 .../juneau/json/JsonSerializerBuilder.java      |    6 +
 .../juneau/msgpack/MsgPackSerializer.java       |    2 +-
 .../msgpack/MsgPackSerializerBuilder.java       |    7 +
 .../plaintext/PlainTextSerializerBuilder.java   |    7 +
 .../juneau/serializer/SerializerBuilder.java    |   26 +
 .../juneau/serializer/SerializerContext.java    |   27 +-
 .../serializer/SerializerGroupBuilder.java      |   11 +
 .../juneau/serializer/SerializerSession.java    |   19 +-
 .../juneau/soap/SoapXmlSerializerBuilder.java   |    6 +
 .../org/apache/juneau/uon/UonSerializer.java    |    2 +-
 .../apache/juneau/uon/UonSerializerBuilder.java |    7 +
 .../UrlEncodingSerializerBuilder.java           |    7 +
 .../juneau/xml/XmlSchemaSerializerBuilder.java  |    6 +
 .../org/apache/juneau/xml/XmlSerializer.java    |    2 +-
 .../apache/juneau/xml/XmlSerializerBuilder.java |    6 +
 juneau-core/src/main/javadoc/overview.html      |    6 +
 .../juneau/examples/rest/AtomFeedResource.java  |    2 +-
 .../juneau/examples/rest/SqlQueryResource.java  |    2 +-
 .../examples/rest/SystemPropertiesResource.java |   20 +-
 .../juneau/examples/rest/TempDirResource.java   |    2 +-
 .../examples/rest/AddressBookResourceTest.java  |   30 +-
 .../apache/juneau/examples/rest/TestUtils.java  |   10 +-
 .../juneau/rest/client/AllowAllRedirects.java   |    8 +-
 .../juneau/rest/client/RestClientBuilder.java   |   11 +
 52 files changed, 8523 insertions(+), 5276 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bde9b101/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
----------------------------------------------------------------------
diff --git 
a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java 
b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
index 7dcd043..9b254a9 100644
--- a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
+++ b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializer.java
@@ -191,7 +191,7 @@ public class RdfSerializer extends WriterSerializer {
                        for (Object o2 : c)
                                serializeAnything(s, o2, false, object(), 
"root", null, null);
                } else {
-                       RDFNode n = serializeAnything(s, o, false, object(), 
"root", null, null);
+                       RDFNode n = serializeAnything(s, o, false, 
s.getExpectedRootType(o), "root", null, null);
                        if (n.isLiteral()) {
                                r = model.createResource();
                                r.addProperty(s.getValueProperty(), n);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bde9b101/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
----------------------------------------------------------------------
diff --git 
a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
 
b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
index 6b150ad..6b8e5bb 100644
--- 
a/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
+++ 
b/juneau-core-rdf/src/main/java/org/apache/juneau/jena/RdfSerializerBuilder.java
@@ -510,6 +510,13 @@ public class RdfSerializerBuilder extends 
SerializerBuilder {
                super.sortMaps(value);
                return this;
        }
+
+       @Override /* SerializerBuilder */
+       public RdfSerializerBuilder abridged(boolean value) {
+               super.abridged(value);
+               return this;
+       }
+       
        @Override /* CoreObjectBuilder */
        public RdfSerializerBuilder beansRequireDefaultConstructor(boolean 
value) {
                super.beansRequireDefaultConstructor(value);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bde9b101/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java 
b/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
new file mode 100644
index 0000000..ae7f737
--- /dev/null
+++ b/juneau-core-test/src/test/java/org/apache/juneau/ComboInput.java
@@ -0,0 +1,89 @@
+// 
***************************************************************************************************************************
+// * 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;
+
+import java.lang.reflect.*;
+
+/** 
+ * Represents the input to a ComboTest.
+ * @param <T>
+ */
+public class ComboInput<T> {
+       
+       final String label;
+       final Object in;
+       final Type type;
+       final String json, jsonT, jsonR, xml, xmlT, xmlR, xmlNs, html, htmlT, 
htmlR, uon, uonT, uonR, urlEncoding,
+               urlEncodingT, urlEncodingR, msgPack, msgPackT, rdfXml, rdfXmlT, 
rdfXmlR;
+       
+       public ComboInput(
+                       String label,
+                       Type type,
+                       T in,
+                       String json,
+                       String jsonT,
+                       String jsonR,
+                       String xml,
+                       String xmlT,
+                       String xmlR,
+                       String xmlNs,
+                       String html,
+                       String htmlT,
+                       String htmlR,
+                       String uon,
+                       String uonT,
+                       String uonR,
+                       String urlEncoding,
+                       String urlEncodingT,
+                       String urlEncodingR,
+                       String msgPack,
+                       String msgPackT,
+                       String rdfXml,
+                       String rdfXmlT,
+                       String rdfXmlR
+               ) {
+               this.label = label;
+               this.type = type;
+               this.in = in;
+               this.json = json;
+               this.jsonT = jsonT;
+               this.jsonR = jsonR;
+               this.xml = xml;
+               this.xmlT = xmlT;
+               this.xmlR = xmlR;
+               this.xmlNs = xmlNs;
+               this.html = html;
+               this.htmlT = htmlT;
+               this.htmlR = htmlR;
+               this.uon = uon;
+               this.uonT = uonT;
+               this.uonR = uonR;
+               this.urlEncoding = urlEncoding;
+               this.urlEncodingT = urlEncodingT;
+               this.urlEncodingR = urlEncodingR;
+               this.msgPack = msgPack;
+               this.msgPackT = msgPackT;
+               this.rdfXml = rdfXml;
+               this.rdfXmlT = rdfXmlT;
+               this.rdfXmlR = rdfXmlR;
+       }
+       
+       /** 
+        * Override this method if you want to do a post-parse verification on 
the object.
+        * <p>
+        * Note that a Function would be preferred here, but it's not available 
in Java 6.
+        * 
+        * @param o The object returned by the parser.
+        */
+       public void verify(T o) {}
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bde9b101/juneau-core-test/src/test/java/org/apache/juneau/ComboTest.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/ComboTest.java 
b/juneau-core-test/src/test/java/org/apache/juneau/ComboTest.java
index 4b89c8e..00535bf 100644
--- a/juneau-core-test/src/test/java/org/apache/juneau/ComboTest.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/ComboTest.java
@@ -30,9 +30,10 @@ import org.junit.*;
 import org.junit.runners.*;
 
 /**
- * Superclass for tests that verify results against all supported content 
types. 
+ * Superclass for tests that verify results against all supported content 
types.
  */
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"unchecked","rawtypes"})
 public abstract class ComboTest {
 
        /* Parameter template */
@@ -62,16 +63,7 @@ public abstract class ComboTest {
 //             /* RdfXmlR */   "xxx",
 //     },
        
-       private final String 
-               label, 
-               oJson, oJsonT, oJsonR,
-               oXml, oXmlT, oXmlR, oXmlNs,
-               oHtml, oHtmlT, oHtmlR,
-               oUon, oUonT, oUonR,
-               oUrlEncoding, oUrlEncodingT, oUrlEncodingR,
-               oMsgPack, oMsgPackT,
-               oRdfXml, oRdfXmlT, oRdfXmlR;
-       private final Object in;
+       private final ComboInput comboInput;
        
        // These are the names of all the tests.
        // You can comment out the names here to skip them.
@@ -129,26 +121,8 @@ public abstract class ComboTest {
        private Map<Serializer,Serializer> serializerMap = new 
IdentityHashMap<Serializer,Serializer>();
        private Map<Parser,Parser> parserMap = new 
IdentityHashMap<Parser,Parser>();
        
-       public ComboTest(
-               String label, 
-               Object in, 
-               String oJson, String oJsonT, String oJsonR,
-               String oXml, String oXmlT, String oXmlR, String oXmlNs,
-               String oHtml, String oHtmlT, String oHtmlR,
-               String oUon, String oUonT, String oUonR,
-               String oUrlEncoding, String oUrlEncodingT, String oUrlEncodingR,
-               String oMsgPack, String oMsgPackT,
-               String oRdfXml, String oRdfXmlT, String oRdfXmlR
-       ) {
-               this.label = label;
-               this.in = in;
-               this.oJson = oJson; this.oJsonT = oJsonT; this.oJsonR = oJsonR;
-               this.oXml = oXml; this.oXmlT = oXmlT; this.oXmlR = oXmlR; 
this.oXmlNs = oXmlNs;
-               this.oHtml = oHtml; this.oHtmlT = oHtmlT; this.oHtmlR = oHtmlR;
-               this.oUon = oUon; this.oUonT = oUonT; this.oUonR = oUonR;
-               this.oUrlEncoding = oUrlEncoding; this.oUrlEncodingT = 
oUrlEncodingT; this.oUrlEncodingR = oUrlEncodingR;
-               this.oMsgPack = oMsgPack; this.oMsgPackT = oMsgPackT; 
-               this.oRdfXml = oRdfXml; this.oRdfXmlT = oRdfXmlT; this.oRdfXmlR 
= oRdfXmlR;
+       public ComboTest(ComboInput<?> comboInput) {
+               this.comboInput = comboInput;
        }
        
        private Serializer getSerializer(Serializer s) throws Exception {
@@ -176,34 +150,34 @@ public abstract class ComboTest {
                        boolean isRdf = s instanceof RdfSerializer;
 
                        if ((isRdf && SKIP_RDF_TESTS) || expected.isEmpty() || 
! runTestsSet.contains(testName) ) {
-                               System.err.println(label + "/" + testName + " 
for "+s.getClass().getSimpleName()+" skipped.");
+                               System.err.println(comboInput.label + "/" + 
testName + " for "+s.getClass().getSimpleName()+" skipped.");
                                return;
                        }
                        
-                       String r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(in) : 
((OutputStreamSerializer)s).serializeToHex(in);
+                       String r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(comboInput.in) : 
((OutputStreamSerializer)s).serializeToHex(comboInput.in);
                        
                        // Can't control RdfSerializer output well, so manually 
remove namespace declarations
                        // double-quotes with single-quotes, and spaces with 
tabs.
                        // Also because RDF sucks really bad and can't be 
expected to produce consistent testable results,
                        // we must also do an expensive sort-then-compare 
operation to verify the results.
-                       if (isRdf) 
+                       if (isRdf)
                                r = r.replaceAll("<rdf:RDF[^>]*>", 
"<rdf:RDF>").replace('"', '\'');
                
                        // Specifying "xxx" in the expected results will spit 
out what we should populate the field with.
                        if (expected.equals("xxx")) {
-                               System.out.println(label + "/" + testName + 
"=\n" + r.replaceAll("\n", "\\\\n").replaceAll("\t", "\\\\t")); // NOT DEBUG
+                               System.out.println(comboInput.label + "/" + 
testName + "=\n" + r.replaceAll("\n", "\\\\n").replaceAll("\t", "\\\\t")); // 
NOT DEBUG
                                System.out.println(r);
                        }
                        
                        if (isRdf)
-                               TestUtils.assertEqualsAfterSort(expected, r, 
"{0}/{1} parse-normal failed", label, testName);
+                               TestUtils.assertEqualsAfterSort(expected, r, 
"{0}/{1} parse-normal failed", comboInput.label, testName);
                        else
-                               TestUtils.assertEquals(expected, r, "{0}/{1} 
parse-normal failed", label, testName);
+                               TestUtils.assertEquals(expected, r, "{0}/{1} 
parse-normal failed", comboInput.label, testName);
                        
                } catch (AssertionError e) {
                        throw e;
                } catch (Exception e) {
-                       throw new AssertionError(label + "/" + testName + " 
failed.  exception=" + e.getLocalizedMessage());
+                       throw new AssertionError(comboInput.label + "/" + 
testName + " failed.  exception=" + e.getLocalizedMessage());
                }
        }
        
@@ -215,43 +189,60 @@ public abstract class ComboTest {
                        boolean isRdf = s instanceof RdfSerializer;
 
                        if ((isRdf && SKIP_RDF_TESTS) || expected.isEmpty() || 
! runTestsSet.contains(testName) ) {
-                               System.err.println(label + "/" + testName + " 
for "+s.getClass().getSimpleName()+" skipped.");
+                               System.err.println(comboInput.label + "/" + 
testName + " for "+s.getClass().getSimpleName()+" skipped.");
                                return;
                        }
                        
-                       String r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(in) : 
((OutputStreamSerializer)s).serializeToHex(in);
-                       Object o = p.parse(r, in == null ? Object.class : 
in.getClass());
+                       String r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(comboInput.in) : 
((OutputStreamSerializer)s).serializeToHex(comboInput.in);
+                       Object o = p.parse(r, comboInput.type);
                        r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(o) : 
((OutputStreamSerializer)s).serializeToHex(o);
                        
-                       if (isRdf) 
+                       if (isRdf)
                                r = r.replaceAll("<rdf:RDF[^>]*>", 
"<rdf:RDF>").replace('"', '\'');
                        
                        if (isRdf)
-                               TestUtils.assertEqualsAfterSort(expected, r, 
"{0}/{1} parse-normal failed", label, testName);
+                               TestUtils.assertEqualsAfterSort(expected, r, 
"{0}/{1} parse-normal failed", comboInput.label, testName);
                        else
-                               TestUtils.assertEquals(expected, r, "{0}/{1} 
parse-normal failed", label, testName);
+                               TestUtils.assertEquals(expected, r, "{0}/{1} 
parse-normal failed", comboInput.label, testName);
 
                } catch (AssertionError e) {
                        throw e;
                } catch (Exception e) {
-                       throw new Exception(label + "/" + testName + " 
failed.", e);
+                       throw new Exception(comboInput.label + "/" + testName + 
" failed.", e);
+               }
+       }
+       
+       private void testParseVerify(String testName, Serializer s, Parser p) 
throws Exception {
+               try {
+                       s = getSerializer(s);
+                       p = getParser(p);
+                       
+                       String r = s.isWriterSerializer() ? 
((WriterSerializer)s).serialize(comboInput.in) : 
((OutputStreamSerializer)s).serializeToHex(comboInput.in);
+                       Object o = p.parse(r, comboInput.type);
+                       
+                       comboInput.verify(o);
+               } catch (AssertionError e) {
+                       throw e;
+               } catch (Exception e) {
+                       throw new Exception(comboInput.label + "/" + testName + 
" failed.", e);
                }
        }
        
+       
        private void testParseJsonEquivalency(String testName, 
OutputStreamSerializer s, InputStreamParser p, String expected) throws 
Exception {
                try {
                        s = (OutputStreamSerializer)getSerializer(s);
                        p = (InputStreamParser)getParser(p);
                        WriterSerializer sJson = 
(WriterSerializer)getSerializer(this.sJson);
 
-                       String r = s.serializeToHex(in);
-                       Object o = p.parse(r, in == null ? Object.class : 
in.getClass());
+                       String r = s.serializeToHex(comboInput.in);
+                       Object o = p.parse(r, comboInput.type);
                        r = sJson.serialize(o);
-                       assertEquals(label + "/" + testName + " parse-normal 
failed on JSON equivalency", expected, r);
+                       assertEquals(comboInput.label + "/" + testName + " 
parse-normal failed on JSON equivalency", expected, r);
                } catch (AssertionError e) {
                        throw e;
                } catch (Exception e) {
-                       throw new Exception(label + "/" + testName + " 
failed.", e);
+                       throw new Exception(comboInput.label + "/" + testName + 
" failed.", e);
                }
        }
        
@@ -270,15 +261,20 @@ public abstract class ComboTest {
        ReaderParser pJson = JsonParser.DEFAULT;
        
        @Test
-       public void serializeJson() throws Exception {
-               testSerialize("serializeJson", sJson, oJson);
+       public void a11_serializeJson() throws Exception {
+               testSerialize("serializeJson", sJson, comboInput.json);
        }
        
        @Test
-       public void parseJson() throws Exception {
-               testParse("parseJson", sJson, pJson, oJson);
+       public void a12_parseJson() throws Exception {
+               testParse("parseJson", sJson, pJson, comboInput.json);
        }
        
+       @Test
+       public void a13_verifyJson() throws Exception {
+               testParseVerify("verifyJson", sJson, pJson);
+       }
+
        
//--------------------------------------------------------------------------------
        // JSON - 't' property
        
//--------------------------------------------------------------------------------
@@ -286,15 +282,20 @@ public abstract class ComboTest {
        ReaderParser pJsonT = new 
JsonParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeJsonT() throws Exception {
-               testSerialize("serializeJsonT", sJsonT, oJsonT);
+       public void a21_serializeJsonT() throws Exception {
+               testSerialize("serializeJsonT", sJsonT, comboInput.jsonT);
        }
        
        @Test
-       public void parseJsonT() throws Exception {
-               testParse("parseJsonT", sJsonT, pJsonT, oJsonT);
+       public void a22_parseJsonT() throws Exception {
+               testParse("parseJsonT", sJsonT, pJsonT, comboInput.jsonT);
        }
        
+       @Test
+       public void a23_verifyJsonT() throws Exception {
+               testParseVerify("verifyJsonT", sJsonT, pJsonT);
+       }
+
        
//--------------------------------------------------------------------------------
        // JSON - Readable
        
//--------------------------------------------------------------------------------
@@ -302,15 +303,20 @@ public abstract class ComboTest {
        ReaderParser pJsonR = JsonParser.DEFAULT;
        
        @Test
-       public void serializeJsonR() throws Exception {
-               testSerialize("serializeJsonR", sJsonR, oJsonR);
+       public void a31_serializeJsonR() throws Exception {
+               testSerialize("serializeJsonR", sJsonR, comboInput.jsonR);
        }
        
        @Test
-       public void parseJsonR() throws Exception {
-               testParse("parseJsonR", sJsonR, pJsonR, oJsonR);
+       public void a32_parseJsonR() throws Exception {
+               testParse("parseJsonR", sJsonR, pJsonR, comboInput.jsonR);
        }
        
+       @Test
+       public void a33_verifyJsonR() throws Exception {
+               testParseVerify("verifyJsonR", sJsonR, pJsonR);
+       }
+
        
//--------------------------------------------------------------------------------
        // XML
        
//--------------------------------------------------------------------------------
@@ -318,15 +324,20 @@ public abstract class ComboTest {
        ReaderParser pXml = XmlParser.DEFAULT;
        
        @Test
-       public void serializeXml() throws Exception {
-               testSerialize("serializeXml", sXml, oXml);
+       public void b11_serializeXml() throws Exception {
+               testSerialize("serializeXml", sXml, comboInput.xml);
        }
        
        @Test
-       public void parseXml() throws Exception {
-               testParse("parseXml", sXml, pXml, oXml);
+       public void b12_parseXml() throws Exception {
+               testParse("parseXml", sXml, pXml, comboInput.xml);
        }
        
+       @Test
+       public void b13_verifyXml() throws Exception {
+               testParseVerify("verifyXml", sXml, pXml);
+       }
+
        
//--------------------------------------------------------------------------------
        // XML - 't' property
        
//--------------------------------------------------------------------------------
@@ -334,13 +345,18 @@ public abstract class ComboTest {
        ReaderParser pXmlT = new 
XmlParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeXmlT() throws Exception {
-               testSerialize("serializeXmlT", sXmlT, oXmlT);
+       public void b21_serializeXmlT() throws Exception {
+               testSerialize("serializeXmlT", sXmlT, comboInput.xmlT);
        }
        
        @Test
-       public void parseXmlT() throws Exception {
-               testParse("parseXmlT", sXmlT, pXmlT, oXmlT);
+       public void b22_parseXmlT() throws Exception {
+               testParse("parseXmlT", sXmlT, pXmlT, comboInput.xmlT);
+       }
+       
+       @Test
+       public void b23_verifyXmlT() throws Exception {
+               testParseVerify("parseXmlTVerify", sXmlT, pXmlT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -350,15 +366,20 @@ public abstract class ComboTest {
        ReaderParser pXmlR = XmlParser.DEFAULT;
        
        @Test
-       public void serializeXmlR() throws Exception {
-               testSerialize("serializeXmlR", sXmlR, oXmlR);
+       public void b31_serializeXmlR() throws Exception {
+               testSerialize("serializeXmlR", sXmlR, comboInput.xmlR);
        }
        
        @Test
-       public void parseXmlR() throws Exception {
-               testParse("parseXmlR", sXmlR, pXmlR, oXmlR);
+       public void b32_parseXmlR() throws Exception {
+               testParse("parseXmlR", sXmlR, pXmlR, comboInput.xmlR);
        }
        
+       @Test
+       public void b33_verifyXmlR() throws Exception {
+               testParseVerify("parseXmlRVerify", sXmlR, pXmlR);
+       }
+
        
//--------------------------------------------------------------------------------
        // XML - Namespaces
        
//--------------------------------------------------------------------------------
@@ -366,15 +387,20 @@ public abstract class ComboTest {
        ReaderParser pXmlNs = XmlParser.DEFAULT;
 
        @Test
-       public void serializeXmlNs() throws Exception {
-               testSerialize("serializeXmlNs", sXmlNs, oXmlNs);
+       public void b41_serializeXmlNs() throws Exception {
+               testSerialize("serializeXmlNs", sXmlNs, comboInput.xmlNs);
        }
        
        @Test
-       public void parseXmlNs() throws Exception {
-               testParse("parseXmlNs", sXmlNs, pXmlNs, oXmlNs);
+       public void b42_parseXmlNs() throws Exception {
+               testParse("parseXmlNs", sXmlNs, pXmlNs, comboInput.xmlNs);
        }
        
+       @Test
+       public void b43_verifyXmlNs() throws Exception {
+               testParseVerify("verifyXmlNs", sXmlNs, pXmlNs);
+       }
+
        
//--------------------------------------------------------------------------------
        // HTML
        
//--------------------------------------------------------------------------------
@@ -382,13 +408,18 @@ public abstract class ComboTest {
        ReaderParser pHtml = HtmlParser.DEFAULT;
        
        @Test
-       public void serializeHtml() throws Exception {
-               testSerialize("serializeHtml", sHtml, oHtml);
+       public void c11_serializeHtml() throws Exception {
+               testSerialize("serializeHtml", sHtml, comboInput.html);
        }
        
        @Test
-       public void parseHtml() throws Exception {
-               testParse("parseHtml", sHtml, pHtml, oHtml);
+       public void c12_parseHtml() throws Exception {
+               testParse("parseHtml", sHtml, pHtml, comboInput.html);
+       }
+       
+       @Test
+       public void c13_verifyHtml() throws Exception {
+               testParseVerify("verifyHtml", sHtml, pHtml);
        }
        
        
//--------------------------------------------------------------------------------
@@ -398,13 +429,18 @@ public abstract class ComboTest {
        ReaderParser pHtmlT =  new 
HtmlParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeHtmlT() throws Exception {
-               testSerialize("serializeHtmlT", sHtmlT, oHtmlT);
+       public void c21_serializeHtmlT() throws Exception {
+               testSerialize("serializeHtmlT", sHtmlT, comboInput.htmlT);
        }
        
        @Test
-       public void parseHtmlT() throws Exception {
-               testParse("parseHtmlT", sHtmlT, pHtmlT, oHtmlT);
+       public void c22_parseHtmlT() throws Exception {
+               testParse("parseHtmlT", sHtmlT, pHtmlT, comboInput.htmlT);
+       }
+       
+       @Test
+       public void c23_verifyHtmlT() throws Exception {
+               testParseVerify("verifyHtmlT", sHtmlT, pHtmlT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -414,13 +450,18 @@ public abstract class ComboTest {
        ReaderParser pHtmlR = HtmlParser.DEFAULT;
        
        @Test
-       public void serializeHtmlR() throws Exception {
-               testSerialize("serializeHtmlR", sHtmlR, oHtmlR);
+       public void c31_serializeHtmlR() throws Exception {
+               testSerialize("serializeHtmlR", sHtmlR, comboInput.htmlR);
+       }
+       
+       @Test
+       public void c32_parseHtmlR() throws Exception {
+               testParse("parseHtmlR", sHtmlR, pHtmlR, comboInput.htmlR);
        }
        
        @Test
-       public void parseHtmlR() throws Exception {
-               testParse("parseHtmlR", sHtmlR, pHtmlR, oHtmlR);
+       public void c33_verifyHtmlR() throws Exception {
+               testParseVerify("verifyHtmlR", sHtmlR, pHtmlR);
        }
        
        
//--------------------------------------------------------------------------------
@@ -430,13 +471,18 @@ public abstract class ComboTest {
        ReaderParser pUon = UonParser.DEFAULT;
        
        @Test
-       public void serializeUon() throws Exception {
-               testSerialize("serializeUon", sUon, oUon);
+       public void d11_serializeUon() throws Exception {
+               testSerialize("serializeUon", sUon, comboInput.uon);
        }
        
        @Test
-       public void parseUon() throws Exception {
-               testParse("parseUon", sUon, pUon, oUon);
+       public void d12_parseUon() throws Exception {
+               testParse("parseUon", sUon, pUon, comboInput.uon);
+       }
+       
+       @Test
+       public void d13_verifyUon() throws Exception {
+               testParseVerify("verifyUon", sUon, pUon);
        }
        
        
//--------------------------------------------------------------------------------
@@ -446,13 +492,18 @@ public abstract class ComboTest {
        ReaderParser pUonT = new 
UonParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeUonT() throws Exception {
-               testSerialize("serializeUonT", sUonT, oUonT);
+       public void d21_serializeUonT() throws Exception {
+               testSerialize("serializeUonT", sUonT, comboInput.uonT);
        }
        
        @Test
-       public void parseUonT() throws Exception {
-               testParse("parseUonT", sUonT, pUonT, oUonT);
+       public void d22_parseUonT() throws Exception {
+               testParse("parseUonT", sUonT, pUonT, comboInput.uonT);
+       }
+       
+       @Test
+       public void d23_verifyUonT() throws Exception {
+               testParseVerify("verifyUonT", sUonT, pUonT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -462,13 +513,18 @@ public abstract class ComboTest {
        ReaderParser pUonR = UonParser.DEFAULT;
        
        @Test
-       public void serializeUonR() throws Exception {
-               testSerialize("serializeUonR", sUonR, oUonR);
+       public void d31_serializeUonR() throws Exception {
+               testSerialize("serializeUonR", sUonR, comboInput.uonR);
        }
        
        @Test
-       public void parseUonR() throws Exception {
-               testParse("parseUonR", sUonR, pUonR, oUonR);
+       public void d32_parseUonR() throws Exception {
+               testParse("parseUonR", sUonR, pUonR, comboInput.uonR);
+       }
+       
+       @Test
+       public void d33_verifyUonR() throws Exception {
+               testParseVerify("verifyUonR", sUonR, pUonR);
        }
        
        
//--------------------------------------------------------------------------------
@@ -478,13 +534,18 @@ public abstract class ComboTest {
        ReaderParser pUrlEncoding = UrlEncodingParser.DEFAULT;
        
        @Test
-       public void serializeUrlEncoding() throws Exception {
-               testSerialize("serializeUrlEncoding", sUrlEncoding, 
oUrlEncoding);
+       public void e11_serializeUrlEncoding() throws Exception {
+               testSerialize("serializeUrlEncoding", sUrlEncoding, 
comboInput.urlEncoding);
        }
        
        @Test
-       public void parseUrlEncoding() throws Exception {
-               testParse("parseUrlEncoding", sUrlEncoding, pUrlEncoding, 
oUrlEncoding);
+       public void e12_parseUrlEncoding() throws Exception {
+               testParse("parseUrlEncoding", sUrlEncoding, pUrlEncoding, 
comboInput.urlEncoding);
+       }
+       
+       @Test
+       public void e13_verifyUrlEncoding() throws Exception {
+               testParseVerify("verifyUrlEncoding", sUrlEncoding, 
pUrlEncoding);
        }
        
        
//--------------------------------------------------------------------------------
@@ -494,13 +555,18 @@ public abstract class ComboTest {
        ReaderParser pUrlEncodingT = new 
UrlEncodingParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeUrlEncodingT() throws Exception {
-               testSerialize("serializeUrlEncodingT", sUrlEncodingT, 
oUrlEncodingT);
+       public void e21_serializeUrlEncodingT() throws Exception {
+               testSerialize("serializeUrlEncodingT", sUrlEncodingT, 
comboInput.urlEncodingT);
+       }
+       
+       @Test
+       public void e22_parseUrlEncodingT() throws Exception {
+               testParse("parseUrlEncodingT", sUrlEncodingT, pUrlEncodingT, 
comboInput.urlEncodingT);
        }
        
        @Test
-       public void parseUrlEncodingT() throws Exception {
-               testParse("parseUrlEncodingT", sUrlEncodingT, pUrlEncodingT, 
oUrlEncodingT);
+       public void e23_verifyUrlEncodingT() throws Exception {
+               testParseVerify("verifyUrlEncodingT", sUrlEncodingT, 
pUrlEncodingT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -510,13 +576,18 @@ public abstract class ComboTest {
        ReaderParser pUrlEncodingR = UrlEncodingParser.DEFAULT;
        
        @Test
-       public void serializeUrlEncodingR() throws Exception {
-               testSerialize("serializeUrlEncodingR", sUrlEncodingR, 
oUrlEncodingR);
+       public void e31_serializeUrlEncodingR() throws Exception {
+               testSerialize("serializeUrlEncodingR", sUrlEncodingR, 
comboInput.urlEncodingR);
        }
        
        @Test
-       public void parseUrlEncodingR() throws Exception {
-               testParse("parseUrlEncodingR", sUrlEncodingR, pUrlEncodingR, 
oUrlEncodingR);
+       public void e32_parseUrlEncodingR() throws Exception {
+               testParse("parseUrlEncodingR", sUrlEncodingR, pUrlEncodingR, 
comboInput.urlEncodingR);
+       }
+       
+       @Test
+       public void e33_verifyUrlEncodingR() throws Exception {
+               testParseVerify("verifyUrlEncodingR", sUrlEncodingR, 
pUrlEncodingR);
        }
        
        
//--------------------------------------------------------------------------------
@@ -526,18 +597,23 @@ public abstract class ComboTest {
        InputStreamParser pMsgPack = MsgPackParser.DEFAULT;
        
        @Test
-       public void serializeMsgPack() throws Exception {
-               testSerialize("serializeMsgPack", sMsgPack, oMsgPack);
+       public void f11_serializeMsgPack() throws Exception {
+               testSerialize("serializeMsgPack", sMsgPack, comboInput.msgPack);
+       }
+       
+       @Test
+       public void f12_parseMsgPack() throws Exception {
+               testParse("parseMsgPack", sMsgPack, pMsgPack, 
comboInput.msgPack);
        }
        
        @Test
-       public void parseMsgPack() throws Exception {
-               testParse("parseMsgPack", sMsgPack, pMsgPack, oMsgPack);
+       public void f13_parseMsgPackJsonEquivalency() throws Exception {
+               testParseJsonEquivalency("parseMsgPackJsonEquivalency", 
sMsgPack, pMsgPack, comboInput.json);
        }
        
        @Test
-       public void parseMsgPackJsonEquivalency() throws Exception {
-               testParseJsonEquivalency("parseMsgPackJsonEquivalency", 
sMsgPack, pMsgPack, oJson);
+       public void f14_verifyMsgPack() throws Exception {
+               testParseVerify("verifyMsgPack", sMsgPack, pMsgPack);
        }
        
        
//--------------------------------------------------------------------------------
@@ -547,18 +623,23 @@ public abstract class ComboTest {
        InputStreamParser pMsgPackT = new 
MsgPackParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeMsgPackT() throws Exception {
-               testSerialize("serializeMsgPackT", sMsgPackT, oMsgPackT);
+       public void f21_serializeMsgPackT() throws Exception {
+               testSerialize("serializeMsgPackT", sMsgPackT, 
comboInput.msgPackT);
+       }
+       
+       @Test
+       public void f22_parseMsgPackT() throws Exception {
+               testParse("parseMsgPackT", sMsgPackT, pMsgPackT, 
comboInput.msgPackT);
        }
        
        @Test
-       public void parseMsgPackT() throws Exception {
-               testParse("parseMsgPackT", sMsgPackT, pMsgPackT, oMsgPackT);
+       public void f23_parseMsgPackTJsonEquivalency() throws Exception {
+               testParseJsonEquivalency("parseMsgPackTJsonEquivalency", 
sMsgPackT, pMsgPackT, comboInput.json);
        }
        
        @Test
-       public void parseMsgPackTJsonEquivalency() throws Exception {
-               testParseJsonEquivalency("parseMsgPackTJsonEquivalency", 
sMsgPackT, pMsgPackT, oJson);
+       public void f24_verifyMsgPackT() throws Exception {
+               testParseVerify("verifyMsgPackT", sMsgPackT, pMsgPackT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -568,13 +649,18 @@ public abstract class ComboTest {
        ReaderParser pRdfXml = RdfParser.DEFAULT_XML;
        
        @Test
-       public void serializeRdfXml() throws Exception {
-               testSerialize("serializeRdfXml", sRdfXml, oRdfXml);
+       public void g11_serializeRdfXml() throws Exception {
+               testSerialize("serializeRdfXml", sRdfXml, comboInput.rdfXml);
        }
        
        @Test
-       public void parseRdfXml() throws Exception {
-               testParse("parseRdfXml", sRdfXml, pRdfXml, oRdfXml);
+       public void g12_parseRdfXml() throws Exception {
+               testParse("parseRdfXml", sRdfXml, pRdfXml, comboInput.rdfXml);
+       }
+       
+       @Test
+       public void g13_verifyRdfXml() throws Exception {
+               testParseVerify("verifyRdfXml", sRdfXml, pRdfXml);
        }
        
        
//--------------------------------------------------------------------------------
@@ -584,13 +670,18 @@ public abstract class ComboTest {
        ReaderParser pRdfXmlT = new 
RdfParserBuilder().beanTypePropertyName("t").build();
        
        @Test
-       public void serializeRdfXmlT() throws Exception {
-               testSerialize("serializeRdfXmlT", sRdfXmlT, oRdfXmlT);
+       public void g21_serializeRdfXmlT() throws Exception {
+               testSerialize("serializeRdfXmlT", sRdfXmlT, comboInput.rdfXmlT);
        }
        
        @Test
-       public void parseRdfXmlT() throws Exception {
-               testParse("parseRdfXmlT", sRdfXmlT, pRdfXmlT, oRdfXmlT);
+       public void g22_parseRdfXmlT() throws Exception {
+               testParse("parseRdfXmlT", sRdfXmlT, pRdfXmlT, 
comboInput.rdfXmlT);
+       }
+       
+       @Test
+       public void g23_verifyRdfXmlT() throws Exception {
+               testParseVerify("parseRdfXmlTVerify", sRdfXmlT, pRdfXmlT);
        }
        
        
//--------------------------------------------------------------------------------
@@ -600,12 +691,17 @@ public abstract class ComboTest {
        ReaderParser pRdfXmlR = RdfParser.DEFAULT_XML;
        
        @Test
-       public void serializeRdfXmlR() throws Exception {
-               testSerialize("serializeRdfXmlR", sRdfXmlR, oRdfXmlR);
+       public void g31_serializeRdfXmlR() throws Exception {
+               testSerialize("serializeRdfXmlR", sRdfXmlR, comboInput.rdfXmlR);
+       }
+       
+       @Test
+       public void g32_parseRdfXmlR() throws Exception {
+               testParse("parseRdfXmlR", sRdfXmlR, pRdfXmlR, 
comboInput.rdfXmlR);
        }
        
        @Test
-       public void parseRdfXmlR() throws Exception {
-               testParse("parseRdfXmlR", sRdfXmlR, pRdfXmlR, oRdfXmlR);
+       public void g33_verifyRdfXmlR() throws Exception {
+               testParseVerify("Verify", sRdfXmlR, pRdfXmlR);
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/bde9b101/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
----------------------------------------------------------------------
diff --git a/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java 
b/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
index ae075e8..eaeb4e7 100755
--- a/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
+++ b/juneau-core-test/src/test/java/org/apache/juneau/TestUtils.java
@@ -13,6 +13,7 @@
 package org.apache.juneau;
 
 import java.io.*;
+import java.lang.reflect.*;
 import java.text.*;
 import java.util.*;
 import java.util.regex.*;
@@ -27,6 +28,7 @@ import org.apache.juneau.internal.*;
 import org.apache.juneau.json.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.transforms.*;
+import org.apache.juneau.utils.*;
 import org.apache.juneau.xml.*;
 import org.junit.*;
 import org.w3c.dom.*;
@@ -61,6 +63,8 @@ public class TestUtils {
                .sortProperties(true)
                .build();
 
+       private static final BeanSession beanSession = 
BeanContext.DEFAULT.createSession();
+
        /**
         * Verifies that two objects are equivalent.
         * Does this by doing a string comparison after converting both to JSON.
@@ -268,11 +272,11 @@ public class TestUtils {
 
        final protected static char[] hexArray = 
"0123456789ABCDEF".toCharArray();
        public static String toHex(byte b) {
-           char[] c = new char[2];
-           int v = b & 0xFF;
-           c[0] = hexArray[v >>> 4];
-           c[1] = hexArray[v & 0x0F];
-           return new String(c);
+               char[] c = new char[2];
+               int v = b & 0xFF;
+               c[0] = hexArray[v >>> 4];
+               c[1] = hexArray[v & 0x0F];
+               return new String(c);
        }
 
        public static void debugOut(Object o) {
@@ -479,13 +483,13 @@ public class TestUtils {
        public static void assertEqualsAfterSort(String expected, String 
actual, String msg, Object...args) {
                String[] e = expected.trim().split("\n"), a = 
actual.trim().split("\n");
                
-               if (e.length != a.length) 
+               if (e.length != a.length)
                        throw new ComparisonFailure(MessageFormat.format(msg, 
args), expected, actual);
                
                Arrays.sort(e);
                Arrays.sort(a);
                
-               for (int i = 0; i < e.length; i++) 
+               for (int i = 0; i < e.length; i++)
                        if (! e[i].equals(a[i]))
                                throw new 
ComparisonFailure(MessageFormat.format(msg, args), expected, actual);
        }
@@ -497,4 +501,21 @@ public class TestUtils {
                if (! StringUtils.isEquals(expected, actual))
                        throw new ComparisonFailure(MessageFormat.format(msg, 
args), expected, actual);                 
        }
+       
+       /**
+        * Creates a ClassMeta for the given types.
+        */
+       public static Type getType(Type type, Type...args) {
+               return beanSession.getClassMeta(type, args);
+       }
+       
+       /**
+        * Throws an AssertionError if the object isn't of the specified type.
+        */
+       public static void assertType(Class<?> type, Object o) {
+               if (type.isInstance(o))
+                       return;
+               throw new AssertionError(new StringMessage("Expected type {0} 
but was {1}", type, (o == null ? null : o.getClass())));
+       }
+       
 }


Reply via email to