http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
new file mode 100755
index 0000000..c028554
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripPrimitivesBeansTest.java
@@ -0,0 +1,367 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+@SuppressWarnings({"unchecked","serial"})
+public class RoundTripPrimitivesBeansTest extends RoundTripTest {
+
+       public RoundTripPrimitivesBeansTest(String label, Serializer s, Parser 
p, int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // testPrimitivesBean
+       
//====================================================================================================
+       @Test
+       public void testPrimitivesBean() throws Exception {
+               PrimitivesBean t = new PrimitivesBean().init();
+               t = roundTrip(t, PrimitivesBean.class);
+
+               // primitives
+               assertEquals(true, t.pBoolean);
+               assertEquals(1, t.pByte);
+               assertEquals('a', t.pChar);
+               assertEquals(2, t.pShort);
+               assertEquals(3, t.pInt);
+               assertEquals(4l, t.pLong);
+               assertEquals(5f, t.pFloat, 0.1f);
+               assertEquals(6d, t.pDouble, 0.1f);
+
+               // uninitialized primitives
+               assertEquals(false, t.puBoolean);
+               assertEquals(0, t.puByte);
+               assertEquals((char)0, t.puChar);
+               assertEquals(0, t.puShort);
+               assertEquals(0, t.puInt);
+               assertEquals(0l, t.puLong);
+               assertEquals(0f, t.puFloat, 0.1f);
+               assertEquals(0d, t.puDouble, 0.1f);
+
+               // primitive arrays
+               assertEquals(false, t.paBoolean[1][0]);
+               assertEquals(2, t.paByte[1][0]);
+               assertEquals('b', t.paChar[1][0]);
+               assertEquals(2, t.paShort[1][0]);
+               assertEquals(2, t.paInt[1][0]);
+               assertEquals(2l, t.paLong[1][0]);
+               assertEquals(2f, t.paFloat[1][0], 0.1f);
+               assertEquals(2d, t.paDouble[1][0], 0.1f);
+               assertNull(t.paBoolean[2]);
+               assertNull(t.paByte[2]);
+               assertNull(t.paChar[2]);
+               assertNull(t.paShort[2]);
+               assertNull(t.paInt[2]);
+               assertNull(t.paLong[2]);
+               assertNull(t.paFloat[2]);
+               assertNull(t.paDouble[2]);
+
+               // uninitialized primitive arrays
+               assertNull(t.pauBoolean);
+               assertNull(t.pauByte);
+               assertNull(t.pauChar);
+               assertNull(t.pauShort);
+               assertNull(t.pauInt);
+               assertNull(t.pauLong);
+               assertNull(t.pauFloat);
+               assertNull(t.pauDouble);
+
+               // anonymous list of primitive arrays
+               assertEquals(true, t.palBoolean.get(0)[0]);
+               assertEquals(1, t.palByte.get(0)[0]);
+               assertEquals('a', t.palChar.get(0)[0]);
+               assertEquals(1, t.palShort.get(0)[0]);
+               assertEquals(1, t.palInt.get(0)[0]);
+               assertEquals(1l, t.palLong.get(0)[0]);
+               assertEquals(1f, t.palFloat.get(0)[0], 0.1f);
+               assertEquals(1d, t.palDouble.get(0)[0], 0.1f);
+               assertNull(t.palBoolean.get(1));
+               assertNull(t.palByte.get(1));
+               assertNull(t.palChar.get(1));
+               assertNull(t.palShort.get(1));
+               assertNull(t.palInt.get(1));
+               assertNull(t.palLong.get(1));
+               assertNull(t.palFloat.get(1));
+               assertNull(t.palDouble.get(1));
+
+               // regular list of primitive arrays
+               assertEquals(true, t.plBoolean.get(0)[0]);
+               assertEquals(1, t.plByte.get(0)[0]);
+               assertEquals('a', t.plChar.get(0)[0]);
+               assertEquals(1, t.plShort.get(0)[0]);
+               assertEquals(1, t.plInt.get(0)[0]);
+               assertEquals(1l, t.plLong.get(0)[0]);
+               assertEquals(1f, t.plFloat.get(0)[0], 0.1f);
+               assertEquals(1d, t.plDouble.get(0)[0], 0.1f);
+               assertNull(t.plBoolean.get(1));
+               assertNull(t.plByte.get(1));
+               assertNull(t.plChar.get(1));
+               assertNull(t.plShort.get(1));
+               assertNull(t.plInt.get(1));
+               assertNull(t.plLong.get(1));
+               assertNull(t.plFloat.get(1));
+               assertNull(t.plDouble.get(1));
+       }
+
+       public static class PrimitivesBean {
+
+               // primitives
+               public boolean pBoolean;
+               public byte pByte;
+               public char pChar;
+               public short pShort;
+               public int pInt;
+               public long pLong;
+               public float pFloat;
+               public double pDouble;
+
+               // uninitialized primitives
+               public boolean puBoolean;
+               public byte puByte;
+               public char puChar;
+               public short puShort;
+               public int puInt;
+               public long puLong;
+               public float puFloat;
+               public double puDouble;
+
+               // primitive arrays
+               public boolean[][] paBoolean;
+               public byte[][] paByte;
+               public char[][] paChar;
+               public short[][] paShort;
+               public int[][] paInt;
+               public long[][] paLong;
+               public float[][] paFloat;
+               public double[][] paDouble;
+
+               // uninitialized primitive arrays
+               public boolean[][] pauBoolean;
+               public byte[][] pauByte;
+               public char[][] pauChar;
+               public short[][] pauShort;
+               public int[][] pauInt;
+               public long[][] pauLong;
+               public float[][] pauFloat;
+               public double[][] pauDouble;
+
+               // Regular lists of primitives
+               public List<boolean[]> plBoolean;
+               public List<byte[]> plByte;
+               public List<char[]> plChar;
+               public List<short[]> plShort;
+               public List<int[]> plInt;
+               public List<long[]> plLong;
+               public List<float[]> plFloat;
+               public List<double[]> plDouble;
+
+               // Anonymous list of primitives
+               public List<boolean[]> palBoolean;
+               public List<byte[]> palByte;
+               public List<char[]> palChar;
+               public List<short[]> palShort;
+               public List<int[]> palInt;
+               public List<long[]> palLong;
+               public List<float[]> palFloat;
+               public List<double[]> palDouble;
+
+               public PrimitivesBean init() {
+                       // primitives
+                       pBoolean = true;
+                       pByte = 1;
+                       pChar = 'a';
+                       pShort = 2;
+                       pInt = 3;
+                       pLong = 4l;
+                       pFloat = 5f;
+                       pDouble = 6d;
+
+                       // primitive arrays
+                       paBoolean = new boolean[][]{{true},{false},null};
+                       paByte = new byte[][]{{1},{2},null};
+                       paChar = new char[][]{{'a'},{'b'},null};
+                       paShort = new short[][]{{1},{2},null};
+                       paInt = new int[][]{{1},{2},null};
+                       paLong = new long[][]{{1},{2},null};
+                       paFloat = new float[][]{{1},{2},null};
+                       paDouble = new double[][]{{1},{2},null};
+
+                       // Regular lists of primitives
+                       plBoolean = new ArrayList<boolean[]>() {{
+                               add(new boolean[]{true}); add(null);
+                       }};
+                       plByte = new ArrayList<byte[]>() {{
+                               add(new byte[]{1}); add(null);
+                       }};
+                       plChar = new ArrayList<char[]>() {{
+                               add(new char[]{'a'}); add(null);
+                       }};
+                       plShort = new ArrayList<short[]>() {{
+                               add(new short[]{1}); add(null);
+                       }};
+                       plInt = new ArrayList<int[]>() {{
+                               add(new int[]{1}); add(null);
+                       }};
+                       plLong = new ArrayList<long[]>() {{
+                               add(new long[]{1}); add(null);
+                       }};
+                       plFloat = new ArrayList<float[]>() {{
+                               add(new float[]{1}); add(null);
+                       }};
+                       plDouble = new ArrayList<double[]>() {{
+                               add(new double[]{1}); add(null);
+                       }};
+
+                       // Anonymous list of primitives
+                       palBoolean = new ArrayList<boolean[]>();
+                       palBoolean.add(new boolean[]{true});
+                       palBoolean.add(null);
+                       palByte = new ArrayList<byte[]>();
+                       palByte.add(new byte[]{1});
+                       palByte.add(null);
+                       palChar = new ArrayList<char[]>();
+                       palChar.add(new char[]{'a'});
+                       palChar.add(null);
+                       palShort = new ArrayList<short[]>();
+                       palShort.add(new short[]{1});
+                       palShort.add(null);
+                       palInt = new ArrayList<int[]>();
+                       palInt.add(new int[]{1});
+                       palInt.add(null);
+                       palLong = new ArrayList<long[]>();
+                       palLong.add(new long[]{1});
+                       palLong.add(null);
+                       palFloat = new ArrayList<float[]>();
+                       palFloat.add(new float[]{1});
+                       palFloat.add(null);
+                       palDouble = new ArrayList<double[]>();
+                       palDouble.add(new double[]{1});
+                       palDouble.add(null);
+                       return this;
+               }
+       }
+
+       
//====================================================================================================
+       // List of PrimitivesBean
+       
//====================================================================================================
+       @Test
+       public void testPrimitivesBeanList() throws Exception {
+               List<PrimitivesBean> t = new ArrayList<PrimitivesBean>() {{
+                       add(new PrimitivesBean().init());
+                       add(null);
+                       add(new PrimitivesBean().init());
+               }};
+               if (p == null)
+                       return;
+               t = roundTrip(t, 
p.getBeanContext().getCollectionClassMeta(List.class, PrimitivesBean.class));
+
+               PrimitivesBean t2 = t.get(2);
+
+               // primitives
+               assertEquals(true, t2.pBoolean);
+               assertEquals(1, t2.pByte);
+               assertEquals('a', t2.pChar);
+               assertEquals(2, t2.pShort);
+               assertEquals(3, t2.pInt);
+               assertEquals(4l, t2.pLong);
+               assertEquals(5f, t2.pFloat, 0.1f);
+               assertEquals(6d, t2.pDouble, 0.1f);
+
+               // uninitialized primitives
+               assertEquals(false, t2.puBoolean);
+               assertEquals(0, t2.puByte);
+               assertEquals((char)0, t2.puChar);
+               assertEquals(0, t2.puShort);
+               assertEquals(0, t2.puInt);
+               assertEquals(0l, t2.puLong);
+               assertEquals(0f, t2.puFloat, 0.1f);
+               assertEquals(0d, t2.puDouble, 0.1f);
+
+               // primitive arrays
+               assertEquals(false, t2.paBoolean[1][0]);
+               assertEquals(2, t2.paByte[1][0]);
+               assertEquals('b', t2.paChar[1][0]);
+               assertEquals(2, t2.paShort[1][0]);
+               assertEquals(2, t2.paInt[1][0]);
+               assertEquals(2l, t2.paLong[1][0]);
+               assertEquals(2f, t2.paFloat[1][0], 0.1f);
+               assertEquals(2d, t2.paDouble[1][0], 0.1f);
+               assertNull(t2.paBoolean[2]);
+               assertNull(t2.paByte[2]);
+               assertNull(t2.paChar[2]);
+               assertNull(t2.paShort[2]);
+               assertNull(t2.paInt[2]);
+               assertNull(t2.paLong[2]);
+               assertNull(t2.paFloat[2]);
+               assertNull(t2.paDouble[2]);
+
+               // uninitialized primitive arrays
+               assertNull(t2.pauBoolean);
+               assertNull(t2.pauByte);
+               assertNull(t2.pauChar);
+               assertNull(t2.pauShort);
+               assertNull(t2.pauInt);
+               assertNull(t2.pauLong);
+               assertNull(t2.pauFloat);
+               assertNull(t2.pauDouble);
+
+               // anonymous list of primitive arrays
+               assertEquals(true, t2.palBoolean.get(0)[0]);
+               assertEquals(1, t2.palByte.get(0)[0]);
+               assertEquals('a', t2.palChar.get(0)[0]);
+               assertEquals(1, t2.palShort.get(0)[0]);
+               assertEquals(1, t2.palInt.get(0)[0]);
+               assertEquals(1l, t2.palLong.get(0)[0]);
+               assertEquals(1f, t2.palFloat.get(0)[0], 0.1f);
+               assertEquals(1d, t2.palDouble.get(0)[0], 0.1f);
+               assertNull(t2.palBoolean.get(1));
+               assertNull(t2.palByte.get(1));
+               assertNull(t2.palChar.get(1));
+               assertNull(t2.palShort.get(1));
+               assertNull(t2.palInt.get(1));
+               assertNull(t2.palLong.get(1));
+               assertNull(t2.palFloat.get(1));
+               assertNull(t2.palDouble.get(1));
+
+               // regular list of primitive arrays
+               assertEquals(true, t2.plBoolean.get(0)[0]);
+               assertEquals(1, t2.plByte.get(0)[0]);
+               assertEquals('a', t2.plChar.get(0)[0]);
+               assertEquals(1, t2.plShort.get(0)[0]);
+               assertEquals(1, t2.plInt.get(0)[0]);
+               assertEquals(1l, t2.plLong.get(0)[0]);
+               assertEquals(1f, t2.plFloat.get(0)[0], 0.1f);
+               assertEquals(1d, t2.plDouble.get(0)[0], 0.1f);
+               assertNull(t2.plBoolean.get(1));
+               assertNull(t2.plByte.get(1));
+               assertNull(t2.plChar.get(1));
+               assertNull(t2.plShort.get(1));
+               assertNull(t2.plInt.get(1));
+               assertNull(t2.plLong.get(1));
+               assertNull(t2.plFloat.get(1));
+               assertNull(t2.plDouble.get(1));
+
+               assertNull(t.get(1));
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripReadOnlyBeansTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripReadOnlyBeansTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripReadOnlyBeansTest.java
new file mode 100755
index 0000000..bf6214c
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripReadOnlyBeansTest.java
@@ -0,0 +1,100 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.junit.Assert.*;
+
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+public class RoundTripReadOnlyBeansTest extends RoundTripTest {
+
+       public RoundTripReadOnlyBeansTest(String label, Serializer s, Parser p, 
int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // test
+       
//====================================================================================================
+       @Test
+       public void test() throws Exception {
+               B t1 = new B(1, "a"), t2 = new B(2, "b");
+               A t3 = new A(t1, t2);
+
+               t3 = roundTrip(t3, A.class);
+               assertEquals(1, t3.getF1().getF1());
+               assertEquals("a", t3.getF1().getF2());
+               assertEquals(2, t3.getF2().getF1());
+               assertEquals("b", t3.getF2().getF2());
+       }
+
+       public static class A {
+               private B f1;
+               private final B f2;
+
+               @BeanConstructor(properties={"f2"})
+               public A(B f2) {
+                       this.f2 = f2;
+               }
+
+               public A(B f1, B f2) {
+                       this.f1 = f1;
+                       this.f2 = f2;
+               }
+
+               public B getF1() {
+                       return f1;
+               }
+
+               public void setF1(B f1) {
+                       this.f1 = f1;
+               }
+
+               public B getF2() {
+                       return f2;
+               }
+       }
+
+       public static class B {
+               private int f1;
+               private final String f2;
+
+               @BeanConstructor(properties={"f2"})
+               public B(String sField) {
+                       this.f2 = sField;
+               }
+
+               public B(int iField, String sField) {
+                       this.f1 = iField;
+                       this.f2 = sField;
+               }
+
+               public int getF1() {
+                       return f1;
+               }
+
+               public void setF1(int f1) {
+                       this.f1 = f1;
+               }
+
+               public String getF2() {
+                       return f2;
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
new file mode 100755
index 0000000..91b7d81
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripSimpleObjectsTest.java
@@ -0,0 +1,750 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class RoundTripSimpleObjectsTest extends RoundTripTest {
+
+       public RoundTripSimpleObjectsTest(String label, Serializer s, Parser p, 
int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // testNull
+       
//====================================================================================================
+       @Test
+       public void testNull() throws Exception {
+               String t = null;
+               t = roundTrip(t);
+               assertNull(t);
+       }
+
+       
//====================================================================================================
+       // testString
+       
//====================================================================================================
+       @Test
+       public void testString() throws Exception {
+               String t = "foobar";
+               t = roundTrip(t);
+               assertEquals("foobar", t);
+               t = "";
+               t = roundTrip(t);
+               assertEquals("", t);
+       }
+
+       
//====================================================================================================
+       // testStringArray
+       
//====================================================================================================
+       @Test
+       public void testStringArray() throws Exception {
+               String[] t = {"foo", null, "null", ""};
+               t = roundTrip(t, String[].class);
+               assertEquals("foo", t[0]);
+               assertNull(t[1]);
+               assertEquals("null", t[2]);
+               assertEquals("", t[3]);
+       }
+
+       
//====================================================================================================
+       // testString2dArray
+       
//====================================================================================================
+       @Test
+       public void testString2dArray() throws Exception {
+               String[][] t = {{"foo", null, "null", ""},null};
+               t = roundTrip(t, String[][].class);
+               assertEquals("foo", t[0][0]);
+               assertNull(t[0][1]);
+               assertEquals("null", t[0][2]);
+               assertEquals("", t[0][3]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testInt
+       
//====================================================================================================
+       @Test
+       public void testInt() throws Exception {
+               int t = 123;
+               t = roundTrip(t);
+               assertEquals(123, t);
+       }
+
+       
//====================================================================================================
+       // testIntArray
+       
//====================================================================================================
+       @Test
+       public void testIntArray() throws Exception {
+               int[] t = roundTrip(new int[]{1,2,3}, int[].class);
+               assertEquals(1, t[0]);
+               assertEquals(2, t[1]);
+               assertEquals(3, t[2]);
+       }
+
+       
//====================================================================================================
+       // testInt2dArray
+       
//====================================================================================================
+       @Test
+       public void testInt2dArray() throws Exception {
+               int[][] t = {{1,2,3},null};
+               t = roundTrip(t, int[][].class);
+               assertEquals(1, t[0][0]);
+               assertEquals(2, t[0][1]);
+               assertEquals(3, t[0][2]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testInt3dArray
+       
//====================================================================================================
+       @Test
+       public void testInt3dArray() throws Exception {
+               int[][][] t = {{{1,2,3},{4,5,6},null},null};
+               t = roundTrip(t, int[][][].class);
+               assertEquals(1, t[0][0][0]);
+               assertEquals(2, t[0][0][1]);
+               assertEquals(3, t[0][0][2]);
+               assertEquals(4, t[0][1][0]);
+               assertEquals(5, t[0][1][1]);
+               assertEquals(6, t[0][1][2]);
+               assertNull(t[0][2]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testBoolean
+       
//====================================================================================================
+       @Test
+       public void testBoolean() throws Exception {
+               boolean t = true;
+               t = roundTrip(t);
+               assertTrue(t);
+               t = false;
+               t = roundTrip(t);
+               assertFalse(t);
+       }
+
+       
//====================================================================================================
+       // testBooleanArray
+       
//====================================================================================================
+       @Test
+       public void testBooleanArray() throws Exception {
+               boolean[] t = {true,false};
+               t = roundTrip(t, boolean[].class);
+               assertTrue(t[0]);
+               assertFalse(t[1]);
+       }
+
+       
//====================================================================================================
+       // testBoolean2dArray
+       
//====================================================================================================
+       @Test
+       public void testBoolean2dArray() throws Exception {
+               boolean[][] t = {{true,false},null};
+               t = roundTrip(t, boolean[][].class);
+               assertTrue(t[0][0]);
+               assertFalse(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testChar
+       
//====================================================================================================
+       @Test
+       public void testChar() throws Exception {
+               char t = 'a';
+               t = roundTrip(t, char.class);
+               assertEquals('a', t);
+       }
+
+       
//====================================================================================================
+       // testCharArray
+       
//====================================================================================================
+       @Test
+       public void testCharArray() throws Exception {
+               char[] t = {'a',0};
+               t = roundTrip(t, char[].class);
+               assertEquals('a', t[0]);
+               assertEquals(0, t[1]);
+       }
+
+       
//====================================================================================================
+       // testChar2dArray
+       
//====================================================================================================
+       @Test
+       public void testChar2dArray() throws Exception {
+               char[][] t = {{'a',0},null};
+               t = roundTrip(t, char[][].class);
+               assertEquals('a', t[0][0]);
+               assertEquals(0, t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testFloat
+       
//====================================================================================================
+       @Test
+       public void testFloat() throws Exception {
+               float t = 1f;
+               t = roundTrip(t, float.class);
+               assertEquals(1f, t, 0.1f);
+       }
+
+       
//====================================================================================================
+       // testFloatArray
+       
//====================================================================================================
+       @Test
+       public void testFloatArray() throws Exception {
+               float[] t = {1f};
+               t = roundTrip(t, float[].class);
+               assertEquals(1f, t[0], 0.1f);
+       }
+
+       
//====================================================================================================
+       // testFloat2dArray
+       
//====================================================================================================
+       @Test
+       public void testFloat2dArray() throws Exception {
+               float[][] t = {{1f},null};
+               t = roundTrip(t, float[][].class);
+               assertEquals(1f, t[0][0], 0.1f);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testDouble
+       
//====================================================================================================
+       @Test
+       public void testDouble() throws Exception {
+               double t = 1d;
+               t = roundTrip(t, double.class);
+               assertEquals(1d, t, 0.1f);
+       }
+
+       
//====================================================================================================
+       // testDoubleArray
+       
//====================================================================================================
+       @Test
+       public void testDoubleArray() throws Exception {
+               double[] t = {1d};
+               t = roundTrip(t, double[].class);
+               assertEquals(1d, t[0], 0.1f);
+       }
+
+       
//====================================================================================================
+       // testDouble2dArray
+       
//====================================================================================================
+       @Test
+       public void testDouble2dArray() throws Exception {
+               double[][] t = {{1d},null};
+               t = roundTrip(t, double[][].class);
+               assertEquals(1d, t[0][0], 0.1f);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testLong
+       
//====================================================================================================
+       @Test
+       public void testLong() throws Exception {
+               long t = 1l;
+               t = roundTrip(t, long.class);
+               assertEquals(1l, t);
+       }
+
+       
//====================================================================================================
+       // testLongArray
+       
//====================================================================================================
+       @Test
+       public void testLongArray() throws Exception {
+               long[] t = {1l};
+               t = roundTrip(t, long[].class);
+               assertEquals(1l, t[0]);
+       }
+
+       
//====================================================================================================
+       // testLong2dArray
+       
//====================================================================================================
+       @Test
+       public void testLong2dArray() throws Exception {
+               long[][] t = {{1l},null};
+               t = roundTrip(t, long[][].class);
+               assertEquals(1l, t[0][0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testShort
+       
//====================================================================================================
+       @Test
+       public void testShort() throws Exception {
+               short t = (short)1;
+               t = roundTrip(t, short.class);
+               assertEquals(1l, t);
+       }
+
+       
//====================================================================================================
+       // testShortArray
+       
//====================================================================================================
+       @Test
+       public void testShortArray() throws Exception {
+               short[] t = {(short)1};
+               t = roundTrip(t, short[].class);
+               assertEquals(1l, t[0]);
+       }
+
+       
//====================================================================================================
+       // testShort2dArray
+       
//====================================================================================================
+       @Test
+       public void testShort2dArray() throws Exception {
+               short[][] t = {{(short)1},null};
+               t = roundTrip(t, short[][].class);
+               assertEquals((short)1, t[0][0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testInteger
+       
//====================================================================================================
+       @Test
+       public void testInteger() throws Exception {
+               Integer t = 123;
+               t = roundTrip(t, Integer.class);
+               assertEquals(new Integer(123), t);
+       }
+
+       
//====================================================================================================
+       // testIntegerArray
+       
//====================================================================================================
+       @Test
+       public void testIntegerArray() throws Exception {
+               Integer[] t = {123, null};
+               t = roundTrip(t, Integer[].class);
+               assertEquals(new Integer(123), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testInteger2dArray
+       
//====================================================================================================
+       @Test
+       public void testInteger2dArray() throws Exception {
+               Integer[][] t = {{123,null},null};
+               t = roundTrip(t, Integer[][].class);
+               assertEquals(new Integer(123), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testInteger3dArray
+       
//====================================================================================================
+       @Test
+       public void testInteger3dArray() throws Exception {
+               Integer[][][] t = {{{123,null},null},null};
+               t = roundTrip(t, Integer[][][].class);
+               assertEquals(new Integer(123), t[0][0][0]);
+               assertNull(t[0][0][1]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testBooleanObject
+       
//====================================================================================================
+       @Test
+       public void testBooleanObject() throws Exception {
+               Boolean t = Boolean.TRUE;
+               t = roundTrip(t, Boolean.class);
+               assertTrue(t);
+               t = Boolean.FALSE;
+               t = roundTrip(t, Boolean.class);
+               assertFalse(t);
+       }
+
+       
//====================================================================================================
+       // testBooleanObjectArray
+       
//====================================================================================================
+       @Test
+       public void testBooleanObjectArray() throws Exception {
+               Boolean[] t = {true,false,null};
+               t = roundTrip(t, Boolean[].class);
+               assertTrue(t[0]);
+               assertFalse(t[1]);
+               assertNull(t[2]);
+       }
+
+       
//====================================================================================================
+       // testBooleanObject2dArray
+       
//====================================================================================================
+       @Test
+       public void testBooleanObject2dArray() throws Exception {
+               Boolean[][] t = {{true,false,null},null};
+               t = roundTrip(t, Boolean[][].class);
+               assertTrue(t[0][0]);
+               assertFalse(t[0][1]);
+               assertNull(t[0][2]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testCharacter
+       
//====================================================================================================
+       @Test
+       public void testCharacter() throws Exception {
+               Character t = 'a';
+               t = roundTrip(t, Character.class);
+               assertEquals(new Character('a'), t);
+       }
+
+       
//====================================================================================================
+       // testCharacterArray
+       
//====================================================================================================
+       @Test
+       public void testCharacterArray() throws Exception {
+               Character[] t = {'a',null};
+               t = roundTrip(t, Character[].class);
+               assertEquals(new Character('a'), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testCharacter2dArray
+       
//====================================================================================================
+       @Test
+       public void testCharacter2dArray() throws Exception {
+               Character[][] t = {{'a',null},null};
+               t = roundTrip(t, Character[][].class);
+               assertEquals(new Character('a'), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testFloatObject
+       
//====================================================================================================
+       @Test
+       public void testFloatObject() throws Exception {
+               Float t = 1f;
+               t = roundTrip(t, Float.class);
+               assertEquals(new Float(1f), t);
+       }
+
+       
//====================================================================================================
+       // testFloatObjectArray
+       
//====================================================================================================
+       @Test
+       public void testFloatObjectArray() throws Exception {
+               Float[] t = {1f, null};
+               t = roundTrip(t, Float[].class);
+               assertEquals(new Float(1f), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testFloatObject2dArray
+       
//====================================================================================================
+       @Test
+       public void testFloatObject2dArray() throws Exception {
+               Float[][] t = {{1f,null},null};
+               t = roundTrip(t, Float[][].class);
+               assertEquals(new Float(1f), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testDoubleObject
+       
//====================================================================================================
+       @Test
+       public void testDoubleObject() throws Exception {
+               Double t = 1d;
+               t = roundTrip(t, Double.class);
+               assertEquals(new Double(1d), t);
+       }
+
+       
//====================================================================================================
+       // testDoubleObjectArray
+       
//====================================================================================================
+       @Test
+       public void testDoubleObjectArray() throws Exception {
+               Double[] t = {1d,null};
+               t = roundTrip(t, Double[].class);
+               assertEquals(new Double(1d), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testDoubleObject2dArray
+       
//====================================================================================================
+       @Test
+       public void testDoubleObject2dArray() throws Exception {
+               Double[][] t = {{1d,null},null};
+               t = roundTrip(t, Double[][].class);
+               assertEquals(new Double(1d), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testLongObject
+       
//====================================================================================================
+       @Test
+       public void testLongObject() throws Exception {
+               Long t = 1l;
+               t = roundTrip(t, Long.class);
+               assertEquals(new Long(1l), t);
+       }
+
+       
//====================================================================================================
+       // testLongObjectArray
+       
//====================================================================================================
+       @Test
+       public void testLongObjectArray() throws Exception {
+               Long[] t = {1l, null};
+               t = roundTrip(t, Long[].class);
+               assertEquals(new Long(1l), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testLongObject2dArray
+       
//====================================================================================================
+       @Test
+       public void testLongObject2dArray() throws Exception {
+               Long[][] t = {{1l,null},null};
+               t = roundTrip(t, Long[][].class);
+               assertEquals(new Long(1l), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testShortObject
+       
//====================================================================================================
+       @Test
+       public void testShortObject() throws Exception {
+               Short t = (short)1;
+               t = roundTrip(t, Short.class);
+               assertEquals(new Short((short)1), t);
+       }
+
+       
//====================================================================================================
+       // testShortObjectArray
+       
//====================================================================================================
+       @Test
+       public void testShortObjectArray() throws Exception {
+               Short[] t = {(short)1,null};
+               t = roundTrip(t, Short[].class);
+               assertEquals(new Short((short)1), t[0]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testShortObject2dArray
+       
//====================================================================================================
+       @Test
+       public void testShortObject2dArray() throws Exception {
+               Short[][] t = {{(short)1,null},null};
+               t = roundTrip(t, Short[][].class);
+               assertEquals(new Short((short)1), t[0][0]);
+               assertNull(t[0][1]);
+               assertNull(t[1]);
+       }
+
+       
//====================================================================================================
+       // testObjectMap
+       
//====================================================================================================
+       @Test
+       public void testObjectMap() throws Exception {
+               ObjectMap t = new 
ObjectMap("{a:'b',c:123,d:false,e:null,f:[123,'abc',true,false,null]}");
+               t = roundTrip(t);
+               assertEquals("b", t.get("a"));
+               assertEquals(123, t.get("c"));
+               assertEquals(false, t.get("d"));
+               assertNull(t.get("e"));
+               List l = (List)t.get("f");
+               assertEquals(123, l.get(0));
+               assertEquals("abc", l.get(1));
+               assertEquals(true, l.get(2));
+               assertEquals(false, l.get(3));
+               assertNull(l.get(4));
+       }
+
+       
//====================================================================================================
+       // testObjectList
+       
//====================================================================================================
+       @Test
+       public void testObjectList() throws Exception {
+               ObjectList t = new 
ObjectList("['abc',123,true,false,null,{a:'b'}]");
+               t = roundTrip(t);
+               assertEquals("abc", t.get(0));
+               assertEquals(123, t.get(1));
+               assertEquals(true, t.get(2));
+               assertEquals(false, t.get(3));
+               assertNull(t.get(4));
+               Map m = (Map)t.get(5);
+               assertEquals("b", m.get("a"));
+       }
+
+       
//====================================================================================================
+       // testTreeMap
+       
//====================================================================================================
+       @Test
+       public void testTreeMap() throws Exception {
+               TreeMap t = new TreeMap();
+               t.put("a", 1);
+               t.put("b", 2);
+               t.put("c", 3);
+               t = roundTrip(t, TreeMap.class);
+               assertEquals(1, t.get("a"));
+               assertEquals(2, t.get("b"));
+               assertEquals(3, t.get("c"));
+
+               t = new TreeMap();
+               t.put("a", true);
+               t.put("b", false);
+               t.put("c", null);
+               t.put("d", "foo");
+               t.put("null", "baz");
+               t.put("a\"a", "a\"a");
+               t.put("b'b", "b'b");
+               t.put("\"cc\"", "\"cc\"");
+               t.put("'dd'", "'dd'");
+               t = roundTrip(t, TreeMap.class);
+               assertEquals(true, t.get("a"));
+               assertEquals(false, t.get("b"));
+               assertNull(t.get("c"));
+               assertEquals("foo", t.get("d"));
+               assertEquals("baz", t.get("null"));
+               assertEquals("a\"a", t.get("a\"a"));
+               assertEquals("b'b", t.get("b'b"));
+               assertEquals("\"cc\"", t.get("\"cc\""));
+               assertEquals("'dd'", t.get("'dd'"));
+       }
+
+       
//====================================================================================================
+       // testLinkedHashMap
+       
//====================================================================================================
+       @Test
+       public void testLinkedHashMap() throws Exception {
+               LinkedHashMap t = new LinkedHashMap();
+               t.put("a", true);
+               t.put("b", false);
+               t.put("c", null);
+               t.put("d", "foo");
+               t.put(null, "bar");
+               t.put("null", "null");
+               t.put("true", "true");
+               t.put("false", "false");
+               t.put("a\"a", "a\"a");
+               t.put("b'b", "b'b");
+               t.put("\"cc\"", "\"cc\"");
+               t.put("'dd'", "'dd'");
+               t.put("<ee>", "<ee>");
+               t.put("<ff/>", "<ff/>");
+               t.put("</gg>", "</gg>");
+               t.put("<>", "<>");
+               t.put("{}", "{}");
+               t.put("[]", "[]");
+               t.put("&", "&");
+               t.put("?", "?");
+               t.put("/", "/");
+               t.put("\b", "\b");
+               t.put("\\b", "\\b");
+               t.put("\n", "\n");
+               t.put("\\n", "\\n");
+               t.put("\t", "\t");
+               t.put("\\t", "\\t");
+               t.put("\f", "\f");
+               t.put("\\f", "\\f");
+               t.put("\\", "\\");
+               t.put("\\\\", "\\\\");
+               t.put("\u2345", "\u2345");
+               t.put("\\u2345", "\\u2345");
+               t.put("\\\u2345", "\\\u2345");
+               t.put("<>{}[]&?/\b\n\t\f\\\\\u2345", 
"<>{}[]&?/\b\n\t\f\\\\\u2345");
+               t = roundTrip(t, LinkedHashMap.class);
+               assertEquals(true, t.get("a"));
+               assertEquals(false, t.get("b"));
+               assertNull(t.get("c"));
+               assertEquals("foo", t.get("d"));
+               assertEquals("bar", t.get(null));
+               assertEquals("null", t.get("null"));
+               assertEquals("true", t.get("true"));
+               assertEquals("false", t.get("false"));
+               assertEquals("a\"a", t.get("a\"a"));
+               assertEquals("b'b", t.get("b'b"));
+               assertEquals("\"cc\"", t.get("\"cc\""));
+               assertEquals("'dd'", t.get("'dd'"));
+               assertEquals("<ee>", t.get("<ee>"));
+               assertEquals("<ff/>", t.get("<ff/>"));
+               assertEquals("</gg>", t.get("</gg>"));
+               assertEquals("<>", t.get("<>"));
+               assertEquals("{}", t.get("{}"));
+               assertEquals("[]", t.get("[]"));
+               assertEquals("&", t.get("&"));
+               assertEquals("?", t.get("?"));
+               assertEquals("/", t.get("/"));
+               assertEquals("\b", t.get("\b"));
+               assertEquals("\\b", t.get("\\b"));
+               assertEquals("\n", t.get("\n"));
+               assertEquals("\\n", t.get("\\n"));
+               assertEquals("\t", t.get("\t"));
+               assertEquals("\\t", t.get("\\t"));
+               assertEquals("\f", t.get("\f"));
+               assertEquals("\\f", t.get("\\f"));
+               assertEquals("\\", t.get("\\"));
+               assertEquals("\\\\", t.get("\\\\"));
+               assertEquals("\u2345", t.get("\u2345"));
+               assertEquals("\\u2345", t.get("\\u2345"));
+               assertEquals("\\\u2345", t.get("\\\u2345"));
+               assertEquals("<>{}[]&?/\b\n\t\f\\\\\u2345", 
t.get("<>{}[]&?/\b\n\t\f\\\\\u2345"));
+       }
+
+       
//====================================================================================================
+       // testVector
+       
//====================================================================================================
+       @Test
+       public void testVector() throws Exception {
+               Vector<Integer> t = new Vector<Integer>();
+               t.add(1);
+               t.add(2);
+               t.add(3);
+               t = roundTripCollection(t, Vector.class, Integer.class);
+       }
+
+       
//====================================================================================================
+       // testNull
+       
//====================================================================================================
+       @Test
+       public void testExtendedUnicode() throws Exception {
+               // Test 4-byte UTF-8 character
+               String t = "𤭢𤭢";
+               t = roundTrip(t);
+               assertEquals("𤭢𤭢", t);
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
new file mode 100755
index 0000000..ad7f5f0
--- /dev/null
+++ b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTest.java
@@ -0,0 +1,301 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.apache.juneau.a.rttests.RoundTripTest.Flags.*;
+import static org.apache.juneau.jena.RdfSerializerContext.*;
+import static org.apache.juneau.serializer.SerializerContext.*;
+import static org.apache.juneau.urlencoding.UonSerializerContext.*;
+import static org.apache.juneau.urlencoding.UrlEncodingContext.*;
+import static org.apache.juneau.xml.XmlSerializerContext.*;
+
+import java.util.*;
+import java.util.Map.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.html.*;
+import org.apache.juneau.jena.*;
+import org.apache.juneau.json.*;
+import org.apache.juneau.msgpack.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.urlencoding.*;
+import org.apache.juneau.xml.*;
+import org.junit.runner.*;
+import org.junit.runners.*;
+
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+@RunWith(Parameterized.class)
+@SuppressWarnings({"unchecked","hiding"})
+public abstract class RoundTripTest {
+
+       public static class Flags {
+               public static int CHECK_XML_WHITESPACE = 1, VALIDATE_XML = 2, 
SERIALIZE_SCHEMA = 4, RETURN_ORIGINAL_OBJECT = 8;
+       }
+
+       @Parameterized.Parameters
+       public static Collection<Object[]> getPairs() {
+               return Arrays.asList(new Object[][] {
+                       // Full round-trip testing
+                       { /* 0 */
+                               "Json - default",
+                               new 
JsonSerializer().setProperty(SERIALIZER_trimNullProperties, false),
+                               JsonParser.DEFAULT,
+                               0
+                       },
+                       { /* 1 */
+                               "Json - lax",
+                               new 
JsonSerializer.Simple().setProperty(SERIALIZER_trimNullProperties, false),
+                               JsonParser.DEFAULT,
+                               0
+                       },
+                       { /* 2 */
+                               "Json - lax, readable",
+                               new 
JsonSerializer.SimpleReadable().setProperty(SERIALIZER_trimNullProperties, 
false),
+                               JsonParser.DEFAULT,
+                               0
+                       },
+                       { /* 3 */
+                               "Xml - namespaces, validation, readable",
+                               new 
XmlSerializer.XmlJsonSq().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(XML_addNamespaceUrisToRoot, 
true).setProperty(SERIALIZER_useIndentation, true),
+                               XmlParser.DEFAULT,
+                               CHECK_XML_WHITESPACE | VALIDATE_XML
+                       },
+                       { /* 4 */
+                               "Xml - no namespaces, validation",
+                               new 
XmlSerializer.SimpleXmlJsonSq().setProperty(SERIALIZER_trimNullProperties, 
false),
+                               XmlParser.DEFAULT,
+                               CHECK_XML_WHITESPACE
+                       },
+                       { /* 5 */
+                               "Html - default",
+                               new 
HtmlSerializer().setProperty(SERIALIZER_trimNullProperties, false),
+                               HtmlParser.DEFAULT,
+                               CHECK_XML_WHITESPACE
+                       },
+                       { /* 6 */
+                               "Html - readable",
+                               new 
HtmlSerializer.SqReadable().setProperty(SERIALIZER_trimNullProperties, false),
+                               HtmlParser.DEFAULT,
+                               CHECK_XML_WHITESPACE
+                       },
+                       { /* 7 */
+                               "Uon - default",
+                               new 
UonSerializer().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(UON_simpleMode, false),
+                               UonParser.DEFAULT,
+                               0
+                       },
+                       { /* 8 */
+                               "Uon - readable",
+                               new 
UonSerializer.Readable().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(UON_simpleMode, false),
+                               UonParser.DEFAULT_WS_AWARE,
+                               0
+                       },
+                       { /* 9 */
+                               "Uon - encoded",
+                               new 
UonSerializer.Encoding().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(UON_simpleMode, false),
+                               UonParser.DEFAULT_DECODING,
+                               0
+                       },
+                       { /* 10 */
+                               "UrlEncoding - default",
+                               new 
UrlEncodingSerializer().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(UON_simpleMode, false),
+                               UrlEncodingParser.DEFAULT,
+                               0
+                       },
+                       { /* 11 */
+                               "UrlEncoding - readable",
+                               new 
UrlEncodingSerializer.Readable().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(UON_simpleMode, false),
+                               UrlEncodingParser.DEFAULT_WS_AWARE,
+                               0
+                       },
+                       { /* 12 */
+                               "UrlEncoding - expanded params",
+                               new 
UrlEncodingSerializer().setProperty(URLENC_expandedParams, 
true).setProperty(UON_simpleMode, false),
+                               new 
UrlEncodingParser().setProperty(URLENC_expandedParams, true),
+                               0
+                       },
+                       { /* 13 */
+                               "Rdf.Xml",
+                               new 
RdfSerializer.Xml().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               RdfParser.DEFAULT_XML,
+                               0
+                       },
+                       { /* 14 */
+                               "Rdf.XmlAbbrev",
+                               new 
RdfSerializer.XmlAbbrev().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               RdfParser.DEFAULT_XML,
+                               0
+                       },
+                       { /* 15 */
+                               "Rdf.Turtle",
+                               new 
RdfSerializer.Turtle().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               RdfParser.DEFAULT_TURTLE,
+                               0
+                       },
+                       { /* 16 */
+                               "Rdf.NTriple",
+                               new 
RdfSerializer.NTriple().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               RdfParser.DEFAULT_NTRIPLE,
+                               0
+                       },
+                       { /* 17 */
+                               "Rdf.N3",
+                               new 
RdfSerializer.N3().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               RdfParser.DEFAULT_N3,
+                               0
+                       },
+                       { /* 18 */
+                               "MsgPack",
+                               new 
MsgPackSerializer().setProperty(SERIALIZER_trimNullProperties, 
false).setProperty(RDF_addLiteralTypes, true),
+                               MsgPackParser.DEFAULT,
+                               0
+                       },
+
+                       // Validation testing only
+                       { /* 19 */
+                               "Json schema",
+                               new 
JsonSchemaSerializer().setProperty(SERIALIZER_trimNullProperties, false),
+                               null,
+                               RETURN_ORIGINAL_OBJECT
+                       },
+                       { /* 20 */
+                               "Xml schema",
+                               new 
XmlSchemaSerializer().setProperty(SERIALIZER_trimNullProperties, false),
+                               new XmlValidatorParser(),
+                               RETURN_ORIGINAL_OBJECT | CHECK_XML_WHITESPACE
+                       },
+               });
+       }
+
+       protected Serializer s;
+       protected Parser p;
+       private boolean validateXmlWhitespace;
+       protected boolean returnOriginalObject;
+       private boolean validateXml;
+       protected String label;
+       public boolean debug = false;
+
+       public RoundTripTest(String label, Serializer s, Parser p, int flags) 
throws Exception {
+               this.s = s.clone().addTransforms(getTransforms());
+               this.p = p == null ? null : 
p.clone().addTransforms(getTransforms());
+               this.label = label;
+
+               Map<Class<Object>, Class<? extends Object>> m = 
getImplClasses();
+               if (m != null) {
+                       for (Entry<Class<Object>, Class<? extends Object>> e : 
m.entrySet()) {
+                               this.s.addImplClass(e.getKey(), e.getValue());
+                               if (this.p != null)
+                                       this.p.addImplClass(e.getKey(), 
e.getValue());
+                       }
+               }
+               this.validateXmlWhitespace = (flags & CHECK_XML_WHITESPACE) > 0;
+               this.validateXml = (flags & VALIDATE_XML) > 0;
+               this.returnOriginalObject = (flags & RETURN_ORIGINAL_OBJECT) > 
0;
+       }
+
+
+       public Class<?>[] getTransforms() {
+               return new Class<?>[0];
+       }
+
+       public <T> Map<Class<T>,Class<? extends T>> getImplClasses() {
+               return null;
+       }
+
+       public <T> T roundTrip(T object, ClassMeta<? extends T> t) throws 
Exception {
+               Object out = serialize(object, this.s);
+               if (p == null)
+                       return object;
+               T o = (T)this.p.parse(out, t);
+               return (returnOriginalObject ? object : o);
+       }
+       public <T> T roundTrip(T object, Class<? extends T> c) throws Exception 
{
+               Object out = serialize(object, this.s);
+               if (p == null)
+                       return object;
+               T o = (T)this.p.parse(out, p.getBeanContext().getClassMeta(c));
+               return (returnOriginalObject ? object : o);
+       }
+       public <K,V,T extends Map<K,V>> T roundTripMap(T object, Class<? 
extends T> c, Class<K> k, Class<V> v) throws Exception {
+               Object out = serialize(object, this.s);
+               if (p == null)
+                       return object;
+               ClassMeta<? extends T> cm = 
p.getBeanContext().getMapClassMeta(c, k, v);
+               T o = (T)this.p.parse(out, cm);
+               return (returnOriginalObject ? object : o);
+       }
+       public <E,T extends Collection<E>> T roundTripCollection(T object, 
Class<? extends T> c, Class<E> e) throws Exception {
+               Object out = serialize(object, this.s);
+               if (p == null)
+                       return object;
+               ClassMeta<? extends T> cm = 
p.getBeanContext().getCollectionClassMeta(c, e);
+               T o = (T)this.p.parse(out, cm);
+               return (returnOriginalObject ? object : o);
+       }
+
+       public <T> T roundTrip(T object) throws Exception {
+               return roundTrip(object, s, p);
+       }
+
+       public <T> T roundTrip(T object, Serializer serializer, Parser parser) 
throws Exception {
+               Object out = serialize(object, serializer);
+               if (parser == null)
+                       return object;
+               T o = (T)parser.parse(out,  object == null ? Object.class : 
object.getClass());
+               return (returnOriginalObject ? object : o);
+       }
+
+       public Serializer getSerializer() {
+               return s;
+       }
+
+       public Parser getParser() {
+               return p;
+       }
+
+       protected void addTransforms(Class<?>...c) {
+               s.addTransforms(c);
+               if (p != null)
+                       p.addTransforms(c);
+       }
+
+       public boolean isValidationOnly() {
+               return returnOriginalObject;
+       }
+
+       public <T> Object serialize(T object, Serializer s) throws Exception {
+
+               Object out = null;
+               if (s.isWriterSerializer())
+                       out = ((WriterSerializer)s).serialize(object);
+               else {
+                       out = ((OutputStreamSerializer)s).serialize(object);
+               }
+
+               if (debug)
+                       System.err.println("Serialized contents from 
["+label+"]...\n---START---\n" + (out instanceof byte[] ? 
TestUtils.toReadableBytes((byte[])out) : out) + "\n---END---\n");
+
+               if (validateXmlWhitespace)
+                       TestUtils.checkXmlWhitespace(out.toString());
+
+               if (validateXml)
+                       TestUtils.validateXml(object, (XmlSerializer)s);
+
+               return out;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
new file mode 100755
index 0000000..9c7a276
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripToObjectMapsTest.java
@@ -0,0 +1,78 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+public class RoundTripToObjectMapsTest extends RoundTripTest {
+
+       public RoundTripToObjectMapsTest(String label, Serializer s, Parser p, 
int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // Class with X(ObjectMap) constructor and toObjectMap() method.
+       
//====================================================================================================
+       @SuppressWarnings({ "serial", "unchecked" })
+       @Test
+       public void test() throws Exception {
+               A a = new A(new ObjectMap("{f1:'a',f2:2}"));
+               a = roundTrip(a, A.class);
+               assertEquals("a", a.f1);
+               assertEquals(2, a.f2);
+
+               A[] aa = new A[]{a};
+               aa = roundTrip(aa, A[].class);
+               assertEquals(1, aa.length);
+               assertEquals("a", aa[0].f1);
+               assertEquals(2, aa[0].f2);
+
+               List<A> a2 = new ArrayList<A>(){{add(new A(new 
ObjectMap("{f1:'a',f2:2}")));}};
+               a2 = roundTrip(a2, 
BeanContext.DEFAULT.getCollectionClassMeta(List.class, A.class));
+               assertEquals(1, a2.size());
+               assertEquals("a", a2.get(0).f1);
+               assertEquals(2, a2.get(0).f2);
+
+               Map<String,A> a3 = new LinkedHashMap<String,A>(){{put("a", new 
A(new ObjectMap("{f1:'a',f2:2}")));}};
+               a3 = roundTrip(a3, 
BeanContext.DEFAULT.getMapClassMeta(Map.class, String.class, A.class));
+               assertEquals(1, a3.size());
+               assertEquals("a", a3.get("a").f1);
+               assertEquals(2, a3.get("a").f2);
+       }
+
+       public static class A {
+               private String f1;
+               private int f2;
+               public A(ObjectMap m) {
+                       this.f1 = m.getString("f1");
+                       this.f2 = m.getInt("f2");
+               }
+               public ObjectMap toObjectMap() {
+                       return new ObjectMap().append("f1",f1).append("f2",f2);
+               }
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
new file mode 100755
index 0000000..0e882eb
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTransformBeansTest.java
@@ -0,0 +1,382 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.util.*;
+
+import javax.xml.datatype.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.annotation.*;
+import org.apache.juneau.annotation.Transform;
+import org.apache.juneau.json.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.apache.juneau.transform.*;
+import org.apache.juneau.transforms.*;
+import org.junit.*;
+
+/**
+ * Tests designed to serialize and parse objects to make sure we end up
+ * with the same objects for all serializers and parsers.
+ */
+@SuppressWarnings({"unchecked","rawtypes","hiding","serial"})
+public class RoundTripTransformBeansTest extends RoundTripTest {
+
+       public RoundTripTransformBeansTest(String label, Serializer s, Parser 
p, int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // testTransformBeans1
+       
//====================================================================================================
+       @Test
+       public void testTransformBeans1() throws Exception {
+               Class<?>[] f = {
+                       ByteArrayBase64Transform.class,
+                       CalendarTransform.ISO8601DTZ.class,
+                       DateTransform.ISO8601DTZ.class
+               };
+               s.addTransforms(f);
+               if (p != null)
+                       p.addTransforms(f);
+               A t = new A().init();
+               t = roundTrip(t, A.class);
+
+               // ByteArrayBase64Transform
+               assertEquals(3, t.fByte[3]);
+               assertNull(t.fnByte);
+               assertEquals(5, t.faByte[2][1]);
+               assertEquals(6, t.flByte.get(1)[2]);
+               assertNull(t.flByte.get(2));
+               assertEquals(6, t.fmByte.get("bar")[2]);
+               assertNull(t.fmByte.get("baz"));
+
+               // CalendarTransform
+               t.fCalendar.setTimeZone(TimeZone.getTimeZone("GMT"));
+               assertEquals(2001, t.fCalendar.get(Calendar.YEAR));
+               assertEquals(01, t.fCalendar.get(Calendar.MONTH));
+               assertEquals(02, t.fCalendar.get(Calendar.DATE));
+               assertEquals(03, t.fCalendar.get(Calendar.HOUR));
+               assertEquals(04, t.fCalendar.get(Calendar.MINUTE));
+               assertEquals(05, t.fCalendar.get(Calendar.SECOND));
+
+               t.faCalendar[0].setTimeZone(TimeZone.getTimeZone("GMT"));
+               assertEquals(2001, t.faCalendar[0].get(Calendar.YEAR));
+               assertEquals(01, t.faCalendar[0].get(Calendar.MONTH));
+               assertEquals(02, t.faCalendar[0].get(Calendar.DATE));
+               assertEquals(03, t.faCalendar[0].get(Calendar.HOUR));
+               assertEquals(04, t.faCalendar[0].get(Calendar.MINUTE));
+               assertEquals(05, t.faCalendar[0].get(Calendar.SECOND));
+               assertNull(t.fnCalendar);
+               assertNull(t.fn2Calendar);
+
+               // DateTransform
+               assertEquals(1000, t.fDate.getTime());
+               assertNull(t.fnDate);
+               assertEquals(3000, t.faDate[2].getTime());
+               assertEquals(4000, t.flDate.get(0).getTime());
+               assertNull(t.flDate.get(1));
+               assertEquals(5000, t.fmDate.get("foo").getTime());
+               assertNull(t.fmDate.get("bar"));
+       }
+
+       public static class A {
+
+               // Test ByteArrayBase64Transform
+               public byte[] fByte;
+               public byte[] fnByte;
+               public byte[][] faByte;
+               public List<byte[]> flByte;
+               public Map<String,byte[]> fmByte;
+
+               public GregorianCalendar fCalendar;
+               public GregorianCalendar fnCalendar;
+               public Calendar fn2Calendar;
+               public GregorianCalendar[] faCalendar;
+
+               public Date fDate;
+               public Date fnDate;
+               public Date[] faDate;
+               public List<Date> flDate;
+               public Map<String,Date> fmDate;
+
+               public A init() {
+                       fByte = new byte[]{0,1,2,3};
+                       fnByte = null;
+                       faByte = new byte[][]{{0,1},{2,3},{4,5}};
+                       flByte = new ArrayList<byte[]>() {{
+                               add(new byte[]{1,2,3});
+                               add(new byte[]{4,5,6});
+                               add(null);
+                       }};
+                       fmByte = new LinkedHashMap<String,byte[]>() {{
+                               put("foo", new byte[]{1,2,3});
+                               put("bar", new byte[]{4,5,6});
+                               put("baz", null);
+                       }};
+
+                       fCalendar = new GregorianCalendar() {{
+                               set(2001, 01, 02, 03, 04, 05);
+                               setTimeZone(TimeZone.getTimeZone("GMT"));
+                       }};
+                       fnCalendar = null;
+                       fn2Calendar = null;
+                       faCalendar = new GregorianCalendar[]{
+                               new GregorianCalendar() {{
+                                       set(2001, 01, 02, 03, 04, 05);
+                                       
setTimeZone(TimeZone.getTimeZone("GMT"));
+                               }}
+                       };
+
+                       fDate = new Date(1000);
+                       fnDate = null;
+                       faDate = new Date[]{
+                               new Date(1000), new Date(2000), new Date(3000)
+                       };
+                       flDate = new ArrayList<Date>() {{
+                               add(new Date(4000));
+                               add(null);
+                       }};
+                       fmDate = new LinkedHashMap<String,Date>() {{
+                               put("foo", new Date(5000));
+                               put("bar", null);
+                       }};
+                       return this;
+               }
+       }
+
+
+       
//====================================================================================================
+       // testTransformBeans2
+       
//====================================================================================================
+       @Test
+       public void testTransformBeans2() throws Exception {
+               Class<?>[] f = {
+                       ByteArrayBase64Transform.class,
+                       CalendarTransform.Medium.class,
+                       DateTransform.RFC2822DT.class,
+               };
+               s.addTransforms(f);
+               if (p != null)
+                       p.addTransforms(f);
+               A t = new A().init();
+               t = roundTrip(t, A.class);
+
+               // ByteArrayBase64Transform
+               assertEquals(3, t.fByte[3]);
+               assertNull(t.fnByte);
+               assertEquals(5, t.faByte[2][1]);
+               assertEquals(6, t.flByte.get(1)[2]);
+               assertNull(t.flByte.get(2));
+               assertEquals(6, t.fmByte.get("bar")[2]);
+               assertNull(t.fmByte.get("baz"));
+
+               // CalendarTransform
+               t.fCalendar.setTimeZone(TimeZone.getTimeZone("GMT"));
+               assertEquals(2001, t.fCalendar.get(Calendar.YEAR));
+               assertEquals(01, t.fCalendar.get(Calendar.MONTH));
+               // Note: We lose precision on the following because of the 
transform type.
+               //assertEquals(02, b.fCalendar.get(Calendar.DATE));
+               //assertEquals(03, b.fCalendar.get(Calendar.HOUR));
+               //assertEquals(04, b.fCalendar.get(Calendar.MINUTE));
+               //assertEquals(05, b.fCalendar.get(Calendar.SECOND));
+
+               t.faCalendar[0].setTimeZone(TimeZone.getTimeZone("GMT"));
+               assertEquals(2001, t.faCalendar[0].get(Calendar.YEAR));
+               assertEquals(01, t.faCalendar[0].get(Calendar.MONTH));
+               // Note: We lose precision on the following because of the 
transform type.
+               //assertEquals(02, b.faCalendar[0].get(Calendar.DATE));
+               //assertEquals(03, b.faCalendar[0].get(Calendar.HOUR));
+               //assertEquals(04, b.faCalendar[0].get(Calendar.MINUTE));
+               //assertEquals(05, b.faCalendar[0].get(Calendar.SECOND));
+               assertNull(t.fnCalendar);
+               assertNull(t.fn2Calendar);
+
+               // DateTransform
+               assertEquals(1000, t.fDate.getTime());
+               assertNull(t.fnDate);
+               assertEquals(3000, t.faDate[2].getTime());
+               assertEquals(4000, t.flDate.get(0).getTime());
+               assertNull(t.flDate.get(1));
+               assertEquals(5000, t.fmDate.get("foo").getTime());
+               assertNull(t.fmDate.get("bar"));
+       }
+
+       
//====================================================================================================
+       // testTransform - Bean.transform annotation
+       
//====================================================================================================
+       @Test
+       public void testTransform() throws Exception {
+               B t = new B();
+               t.f1 = "bar";
+               t = roundTrip(t, B.class);
+
+               assertEquals("bar", t.f1);
+       }
+
+       @Transform(BTransform.class)
+       public static class B {
+               public String f1;
+       }
+
+       public static class BTransform extends PojoTransform<B,String> {
+               @Override /* PojoTransform */
+               public String transform(B o) throws SerializeException {
+                       return o.f1;
+               }
+               @Override /* PojoTransform */
+               public B normalize(String f, ClassMeta<?> hint) throws 
ParseException {
+                       B b1 = new B();
+                       b1.f1 = f;
+                       return b1;
+               }
+       }
+
+       
//====================================================================================================
+       // testXMLGregorianCalendar - Test XMLGregorianCalendarTransform class.
+       
//====================================================================================================
+       @Test
+       public void testXMLGregorianCalendar() throws Exception {
+
+               if (isValidationOnly())
+                       return;
+
+               GregorianCalendar gc = new GregorianCalendar();
+               XMLGregorianCalendar c = 
DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
+
+               Serializer s = 
getSerializer().clone().addTransforms(XMLGregorianCalendarTransform.class);
+               Parser p = 
getParser().clone().addTransforms(XMLGregorianCalendarTransform.class);
+
+               Object r = s.serialize(c);
+               XMLGregorianCalendar c2 = p.parse(r, 
XMLGregorianCalendar.class);
+               assertEquals(c, c2);
+       }
+
+       
//====================================================================================================
+       // testSubTypeWithGenerics
+       
//====================================================================================================
+       @Test
+       public void testSubTypeWithGenerics() throws Exception {
+               JsonSerializer s = JsonSerializer.DEFAULT;
+
+               C1 c1 = C3.create();
+               String r = s.serialize(c1);
+               
assertEquals("{\"type\":\"C3\",\"f1\":{\"f2\":\"f2\",\"f3\":3}}", r);
+       }
+
+
+       @Bean(
+               subTypeProperty="type",
+               subTypes={
+                       @BeanSubType(id="C3", type=C3.class)
+               }
+       )
+       public static interface C1<T> extends Serializable {
+               void setF1(T f1);
+               T getF1();
+       }
+
+       public abstract static class C2<T> implements C1<T> {
+               protected T f1;
+
+               @Override /* C1 */
+               public void setF1(T f1) {
+                       this.f1 = f1;
+               }
+
+               @Override /* C1 */
+               public T getF1() {
+                       return f1;
+               }
+       }
+
+       public static class C3<T> extends C2<T> {
+
+               public static C3 create() {
+                       C3 c3 = new C3<Object>();
+                       CDTO cdto = new CDTO();
+                       cdto.f2 = "f2";
+                       cdto.f3 = 3;
+                       c3.f1 = cdto;
+                       return c3;
+               }
+
+               @Override /* C1 */
+               public void setF1(T f1) {
+                       this.f1 = f1;
+               }
+
+               @Override /* C1 */
+               public T getF1() {
+                       return f1;
+               }
+       }
+
+       public static class CDTO {
+               public String f2;
+               public int f3;
+       }
+
+
+       
//====================================================================================================
+       // Surrogate transforms
+       
//====================================================================================================
+       @Test
+       public void testSurrogateTransform() throws Exception {
+               addTransforms(D2.class);
+
+               JsonSerializer s = new 
JsonSerializer.Simple().addTransforms(D2.class);
+               JsonParser p = new JsonParser().addTransforms(D2.class);
+               Object r;
+               D1 d1 = D1.create();
+
+               r = s.serialize(d1);
+               assertEquals("{f2:'f1'}", r);
+
+               d1 = p.parse(r, D1.class);
+               assertEquals("f1", d1.f1);
+
+               r = getSerializer().serialize(d1);
+               assertTrue(TestUtils.toString(r).contains("f2"));
+
+               d1 = roundTrip(d1, D1.class);
+       }
+
+       public static class D1 {
+               public String f1;
+
+               public static D1 create() {
+                       D1 d1 = new D1();
+                       d1.f1 = "f1";
+                       return d1;
+               }
+       }
+
+       public static class D2 {
+               public String f2;
+               public D2(D1 d1) {
+                       f2 = d1.f1;
+               }
+               public D2() {
+               }
+               public static D1 valueOf(D2 d2) {
+                       D1 d1 = new D1();
+                       d1.f1 = d2.f2;
+                       return d1;
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
----------------------------------------------------------------------
diff --git 
a/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
new file mode 100755
index 0000000..83b9e67
--- /dev/null
+++ 
b/juneau-core/src/test/java/org/apache/juneau/a/rttests/RoundTripTrimStringsTest.java
@@ -0,0 +1,98 @@
+/***************************************************************************************************************************
+ * 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.a.rttests;
+
+import static org.apache.juneau.TestUtils.*;
+
+import org.apache.juneau.*;
+import org.apache.juneau.parser.*;
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+
+/**
+ * Tests for the {@link SerializerContext#SERIALIZER_trimStrings} and {@link 
ParserContext#PARSER_trimStrings}.
+ */
+public class RoundTripTrimStringsTest extends RoundTripTest {
+
+       public RoundTripTrimStringsTest(String label, Serializer s, Parser p, 
int flags) throws Exception {
+               super(label, s, p, flags);
+       }
+
+       
//====================================================================================================
+       // test
+       
//====================================================================================================
+       @SuppressWarnings("hiding")
+       @Test
+       public void test() throws Exception {
+               if (isValidationOnly())
+                       return;
+               Serializer s = getSerializer();
+               Parser p = getParser();
+               Object in, a, e;
+
+               Serializer s2 = 
s.clone().setProperty(SerializerContext.SERIALIZER_trimStrings, true);
+               Parser p2 = 
p.clone().setProperty(ParserContext.PARSER_trimStrings, true);
+
+               in = " foo bar ";
+               e = "foo bar";
+               a = p.parse(s2.serialize(in), String.class);
+               assertEqualObjects(e, a);
+               a = p2.parse(s.serialize(in), String.class);
+               assertEqualObjects(e, a);
+
+               in = new ObjectMap("{' foo ': ' bar '}");
+               e = new ObjectMap("{foo:'bar'}");
+               a = p.parse(s2.serialize(in), ObjectMap.class);
+               assertEqualObjects(e, a);
+               a = p2.parse(s.serialize(in), ObjectMap.class);
+               assertEqualObjects(e, a);
+
+               in = new ObjectList("[' foo ', {' foo ': ' bar '}]");
+               e = new ObjectList("['foo',{foo:'bar'}]");
+               a = p.parse(s2.serialize(in), ObjectList.class);
+               assertEqualObjects(e, a);
+               a = p2.parse(s.serialize(in), ObjectList.class);
+               assertEqualObjects(e, a);
+
+               in = new A().init1();
+               e = new A().init2();
+               a = p.parse(s2.serialize(in), A.class);
+               assertEqualObjects(e, a);
+               a = p2.parse(s.serialize(in), A.class);
+               assertEqualObjects(e, a);
+       }
+
+       public static class A {
+               public String f1;
+               public String[] f2;
+               public ObjectList f3;
+               public ObjectMap f4;
+
+               public A init1() throws Exception {
+                       f1 = " f1 ";
+                       f2 = new String[]{" f2a ", " f2b "};
+                       f3 = new ObjectList("[' f3a ',' f3b ']");
+                       f4 = new ObjectMap("{' foo ':' bar '}");
+                       return this;
+               }
+
+               public A init2() throws Exception {
+                       f1 = "f1";
+                       f2 = new String[]{"f2a", "f2b"};
+                       f3 = new ObjectList("['f3a','f3b']");
+                       f4 = new ObjectMap("{'foo':'bar'}");
+                       return this;
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/csv/CsvTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/test/java/org/apache/juneau/csv/CsvTest.java 
b/juneau-core/src/test/java/org/apache/juneau/csv/CsvTest.java
new file mode 100755
index 0000000..09453df
--- /dev/null
+++ b/juneau-core/src/test/java/org/apache/juneau/csv/CsvTest.java
@@ -0,0 +1,50 @@
+/***************************************************************************************************************************
+ * 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.csv;
+
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.apache.juneau.serializer.*;
+import org.junit.*;
+
+public class CsvTest {
+
+       
//====================================================================================================
+       // testBasic
+       
//====================================================================================================
+       @Test
+       public void testBasic() throws Exception {
+               List<A> l = new LinkedList<A>();
+               l.add(new A("b1",1));
+               l.add(new A("b2",2));
+
+               WriterSerializer s = new CsvSerializer();
+               String r;
+
+               r = s.serialize(l);
+
+               assertEquals("b,c\nb1,1\nb2,2\n", r);
+       }
+
+       public static class A {
+               public String b;
+               public int c;
+
+               public A(String b, int c) {
+                       this.b = b;
+                       this.c = c;
+               }
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e6bf97a8/juneau-core/src/test/java/org/apache/juneau/dto/atom/AtomTest.java
----------------------------------------------------------------------
diff --git a/juneau-core/src/test/java/org/apache/juneau/dto/atom/AtomTest.java 
b/juneau-core/src/test/java/org/apache/juneau/dto/atom/AtomTest.java
new file mode 100755
index 0000000..5e78d27
--- /dev/null
+++ b/juneau-core/src/test/java/org/apache/juneau/dto/atom/AtomTest.java
@@ -0,0 +1,102 @@
+/***************************************************************************************************************************
+ * 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.dto.atom;
+
+import static javax.xml.bind.DatatypeConverter.*;
+import static org.apache.juneau.BeanContext.*;
+import static org.apache.juneau.TestUtils.*;
+import static org.apache.juneau.xml.XmlSerializerContext.*;
+import static org.junit.Assert.*;
+
+import java.net.*;
+
+import org.apache.juneau.xml.*;
+import org.junit.*;
+
+
+public class AtomTest {
+
+       @Test
+       public void testBasic() throws Exception {
+               XmlSerializer s;
+               XmlParser p = XmlParser.DEFAULT;
+               String expected, r;
+               Feed f2;
+
+               Feed f = new Feed()
+                       .setTitle(new Text("text", "dive into mark"))
+                       .setSubTitle(new Text("html", "A <em>lot</em> of effort 
went into making this effortless"))
+                       .setUpdated(parseDateTime("2005-07-31T12:29:29Z"))
+                       .setId(new Id("tag:example.org,2003:3"))
+                       .addLinks(
+                               new Link("alternate", "text/html", 
"http://example.org/";).setHreflang("en"),
+                               new Link("self", "application/atom+xml", 
"http://example.org/feed.atom";)
+                       )
+                       .setRights(new Text("Copyright (c) 2003, Mark Pilgrim"))
+                       .setGenerator(new Generator("Example 
Toolkit").setUri(new URI("http://www.example.com/";)).setVersion("1.0"))
+                       .addEntries(
+                               new Entry()
+                                       .setTitle(new Text("Atom draft-07 
snapshot"))
+                                       .addLinks(
+                                               new Link("alternate", 
"text/html", "http://example.org/2005/04/02/atom";),
+                                               new Link("enclosure", 
"audio/mpeg", "http://example.org/audio/ph34r_my_podcast.mp3";).setLength(1337)
+                                       )
+                                       .setId(new 
Id("tag:example.org,2003:3.2397"))
+                                       
.setUpdated(parseDateTime("2005-07-31T12:29:29Z"))
+                                       
.setPublished(parseDateTime("2003-12-13T08:29:29-04:00"))
+                                       .addAuthors(new Person("Mark 
Pilgrim").setUri(new URI("http://example.org/";)).setEmail("[email protected]"))
+                                       .addContributors(
+                                               new Person("Sam Ruby"),
+                                               new Person("Joe Gregorio")
+                                       )
+                                       .setContent(
+                                               new Content()
+                                                       .setLang("en")
+                                                       .setBase(new 
URI("http://diveintomark.org/";))
+                                                       .setType("xhtml")
+                                                       .setText("<div 
xmlns=\"http://www.w3.org/1999/xhtml\";><p><i>[Update: The Atom draft is 
finished.]</i></p></div>")
+                                       )
+                       )
+               ;
+
+               
//--------------------------------------------------------------------------------
+               // Test without namespaces
+               
//--------------------------------------------------------------------------------
+               s = new 
XmlSerializer.SqReadable().setProperty(XML_enableNamespaces, 
false).setProperty(BEAN_sortProperties, true);
+               expected = 
readFile(getClass().getResource("/dto/atom/test1.xml").getPath());
+               r = s.serialize(f);
+               assertEquals(expected, r);
+               f2 = p.parse(r, Feed.class);
+               assertEqualObjects(f, f2);
+
+               
//--------------------------------------------------------------------------------
+               // Test with namespaces
+               
//--------------------------------------------------------------------------------
+               s = new 
XmlSerializer.SqReadable().setProperty(BEAN_sortProperties, true);
+               expected = 
readFile(getClass().getResource("/dto/atom/test2.xml").getPath());
+               r = s.serialize(f);
+               assertEquals(expected, r);
+               f2 = p.parse(r, Feed.class);
+               assertEqualObjects(f, f2);
+
+               
//--------------------------------------------------------------------------------
+               // Test with namespaces but with atom as the default namespace
+               
//--------------------------------------------------------------------------------
+               s = new 
XmlSerializer.SqReadable().setProperty(XML_defaultNamespaceUri, 
"atom").setProperty(BEAN_sortProperties, true);
+               expected = 
readFile(getClass().getResource("/dto/atom/test3.xml").getPath());
+               r = s.serialize(f);
+               assertEquals(expected, r);
+               f2 = p.parse(r, Feed.class);
+               assertEqualObjects(f, f2);
+       }
+}

Reply via email to