Java Code Examples for io.protostuff.ByteString#copyFromUtf8()

The following examples show how to use io.protostuff.ByteString#copyFromUtf8() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NullArrayElementTest.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public void testNullFirst() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(
            new Boolean[] { null, true, false },
            new Character[] { null, 'a', 'b' },
            new Short[] { null, 1, 2 },
            new Integer[] { null, 1, 2 },
            new Long[] { null, 1l, 2l },
            new Float[] { null, 1.1f, 2.2f },
            new Double[] { null, 1.1d, 2.2d },
            new String[] { null, "a", "b" },
            new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b") },
            new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' } },
            new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d) },
            new BigInteger[] { null, new BigInteger("1"), new BigInteger("2") },
            new Date[] { null, new Date(), new Date() },
            new Size[] { null, Size.MEDIUM, Size.LARGE },
            new SomePojo[] { null, new SomePojo("a"), new SomePojo("b") }
            );

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 2
Source File: NullArrayElementTest.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public void testNullLast() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(
            new Boolean[] { true, false, null },
            new Character[] { 'a', 'b', null },
            new Short[] { 1, 2, null },
            new Integer[] { 1, 2, null },
            new Long[] { 1l, 2l, null },
            new Float[] { 1.1f, 2.2f, null },
            new Double[] { 1.1d, 2.2d, null },
            new String[] { "a", "b", null },
            new ByteString[] { ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null },
            new byte[][] { new byte[] { 'a' }, new byte[] { 'b' }, null },
            new BigDecimal[] { new BigDecimal(1.1d), new BigDecimal(2.2d), null },
            new BigInteger[] { new BigInteger("1"), new BigInteger("2"), null },
            new Date[] { new Date(), new Date(), null },
            new Size[] { Size.MEDIUM, Size.LARGE, null },
            new SomePojo[] { new SomePojo("a"), new SomePojo("b"), null }
            );

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 3
Source File: NullArrayElementTest.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public void testNullMid() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(
            new Boolean[] { true, null, false },
            new Character[] { 'a', null, 'b' },
            new Short[] { 1, null, 2 },
            new Integer[] { 1, null, 2 },
            new Long[] { 1l, null, 2l },
            new Float[] { 1.1f, null, 2.2f },
            new Double[] { 1.1d, null, 2.2d },
            new String[] { "a", null, "b" },
            new ByteString[] { ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b") },
            new byte[][] { new byte[] { 'a' }, null, new byte[] { 'b' } },
            new BigDecimal[] { new BigDecimal(1.1d), null, new BigDecimal(2.2d) },
            new BigInteger[] { new BigInteger("1"), null, new BigInteger("2") },
            new Date[] { new Date(), null, new Date() },
            new Size[] { Size.MEDIUM, null, Size.LARGE },
            new SomePojo[] { new SomePojo("a"), null, new SomePojo("b") }
            );

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 4
Source File: NullArrayElementTest.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public void testNullFirstAndLast() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(
            new Boolean[] { null, true, false, null },
            new Character[] { null, 'a', 'b', null },
            new Short[] { null, 1, 2, null },
            new Integer[] { null, 1, 2, null },
            new Long[] { null, 1l, 2l, null },
            new Float[] { null, 1.1f, 2.2f, null },
            new Double[] { null, 1.1d, 2.2d, null },
            new String[] { null, "a", "b", null },
            new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null },
            new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' }, null },
            new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d), null },
            new BigInteger[] { null, new BigInteger("1"), new BigInteger("2"), null },
            new Date[] { null, new Date(), new Date(), null },
            new Size[] { null, Size.MEDIUM, Size.LARGE, null },
            new SomePojo[] { null, new SomePojo("a"), new SomePojo("b"), null }
            );

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 5
Source File: NullArrayElementTest.java    From protostuff with Apache License 2.0 5 votes vote down vote up
public void testNullInBetween() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(
            new Boolean[] { null, true, null, false, null },
            new Character[] { null, 'a', null, 'b', null },
            new Short[] { null, 1, null, 2, null },
            new Integer[] { null, 1, null, 2, null },
            new Long[] { null, 1l, null, 2l, null },
            new Float[] { null, 1.1f, null, 2.2f, null },
            new Double[] { null, 1.1d, null, 2.2d, null },
            new String[] { null, "a", null, "b", null },
            new ByteString[] { null, ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b"), null },
            new byte[][] { null, new byte[] { 'a' }, null, new byte[] { 'b' }, null },
            new BigDecimal[] { null, new BigDecimal(1.1d), null, new BigDecimal(2.2d), null },
            new BigInteger[] { null, new BigInteger("1"), null, new BigInteger("2"), null },
            new Date[] { null, new Date(), null, new Date(), null },
            new Size[] { null, Size.MEDIUM, null, Size.LARGE, null },
            new SomePojo[] { null, new SomePojo("a"), null, new SomePojo("b"), null }
            );

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 6
Source File: CompatTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
static ByteString bs(String text)
{
    return ByteString.copyFromUtf8(text);
}
 
Example 7
Source File: NullArrayElementInObjectArrayTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public void testNullFirst() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    Object[] objectArray = new Object[] {
            new Boolean[] { null, true, false },
            Arrays.asList(new Boolean[] { null, true, false }),
            
            new Character[] { null, 'a', 'b' },
            Arrays.asList(new Character[] { null, 'a', 'b' }),
            
            new Short[] { null, 1, 2 },
            Arrays.asList(new Short[] { null, 1, 2 }),
            
            new Integer[] { null, 1, 2 },
            Arrays.asList(new Integer[] { null, 1, 2 }),
            
            new Long[] { null, 1l, 2l },
            Arrays.asList(new Long[] { null, 1l, 2l }),
            
            new Float[] { null, 1.1f, 2.2f },
            Arrays.asList(new Float[] { null, 1.1f, 2.2f }),
            
            new Double[] { null, 1.1d, 2.2d },
            Arrays.asList(new Double[] { null, 1.1d, 2.2d }),
            
            new String[] { null, "a", "b" },
            Arrays.asList(new String[] { null, "a", "b" }),
            
            new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b") },
            Arrays.asList(new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b") }),
            
            new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' } },
            Arrays.asList(new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' } }),
            
            new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d) },
            Arrays.asList(new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d) }),
            
            new BigInteger[] { null, new BigInteger("1"), new BigInteger("2") },
            Arrays.asList(new BigInteger[] { null, new BigInteger("1"), new BigInteger("2") }),
            
            new Date[] { null, new Date(), new Date() },
            Arrays.asList(new Date[] { null, new Date(), new Date() }),
            
            new Baz[] { null, new Baz(0, "0", 0), new Baz(1, "1", 1) },
            Arrays.asList(new Baz[] { null, new Baz(0, "0", 0), new Baz(1, "1", 1) })
    };
    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(objectArray);

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertArrayObjectEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertArrayObjectEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 8
Source File: NullArrayElementInObjectArrayTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public void testNullLast() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    Object[] objectArray = new Object[] {
            new Boolean[] { true, false, null },
            Arrays.asList(new Boolean[] { true, false, null }),
            
            new Character[] { 'a', 'b', null },
            Arrays.asList(new Character[] { 'a', 'b', null }),
            
            new Short[] { 1, 2, null },
            Arrays.asList(new Short[] { 1, 2, null }),
            
            new Integer[] { 1, 2, null },
            Arrays.asList(new Integer[] { 1, 2, null }),
            
            new Long[] { 1l, 2l, null },
            Arrays.asList(new Long[] { 1l, 2l, null }),
            
            new Float[] { 1.1f, 2.2f, null },
            Arrays.asList(new Float[] { 1.1f, 2.2f, null }),
            
            new Double[] { 1.1d, 2.2d, null },
            Arrays.asList(new Double[] { 1.1d, 2.2d, null }),
            
            new String[] { "a", "b", null },
            Arrays.asList(new String[] { "a", "b", null }),
            
            new ByteString[] { ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null },
            Arrays.asList(new ByteString[] { ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null }),
            
            new byte[][] { new byte[] { 'a' }, new byte[] { 'b' }, null },
            Arrays.asList(new byte[][] { new byte[] { 'a' }, new byte[] { 'b' }, null }),
            
            new BigDecimal[] { new BigDecimal(1.1d), new BigDecimal(2.2d), null },
            Arrays.asList(new BigDecimal[] { new BigDecimal(1.1d), new BigDecimal(2.2d), null }),
            
            new BigInteger[] { new BigInteger("1"), new BigInteger("2"), null },
            Arrays.asList(new BigInteger[] { new BigInteger("1"), new BigInteger("2"), null }),
            
            new Date[] { new Date(), new Date(), null },
            Arrays.asList(new Date[] { new Date(), new Date(), null }),
            
            new Baz[] { new Baz(0, "0", 0), new Baz(1, "1", 1), null },
            Arrays.asList(new Baz[] { new Baz(0, "0", 0), new Baz(1, "1", 1), null })
    };
    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(objectArray);

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertArrayObjectEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertArrayObjectEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 9
Source File: NullArrayElementInObjectArrayTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public void testNullMid() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    Object[] objectArray = new Object[] {
            new Boolean[] { true, null, false },
            Arrays.asList(new Boolean[] { true, null, false }),
            
            new Character[] { 'a', null, 'b' },
            Arrays.asList(new Character[] { 'a', null, 'b' }),
            
            new Short[] { 1, null, 2 },
            Arrays.asList(new Short[] { 1, null, 2 }),
            
            new Integer[] { 1, null, 2 },
            Arrays.asList(new Integer[] { 1, null, 2 }),
            
            new Long[] { 1l, null, 2l },
            Arrays.asList(new Long[] { 1l, null, 2l }),
            
            new Float[] { 1.1f, null, 2.2f },
            Arrays.asList(new Float[] { 1.1f, null, 2.2f }),
            
            new Double[] { 1.1d, null, 2.2d },
            Arrays.asList(new Double[] { 1.1d, null, 2.2d }),
            
            new String[] { "a", null, "b" },
            Arrays.asList(new String[] { "a", null, "b" }),
            
            new ByteString[] { ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b") },
            Arrays.asList(new ByteString[] { ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b") }),
            
            new byte[][] { new byte[] { 'a' }, null, new byte[] { 'b' } },
            Arrays.asList(new byte[][] { new byte[] { 'a' }, null, new byte[] { 'b' } }),
            
            new BigDecimal[] { new BigDecimal(1.1d), null, new BigDecimal(2.2d) },
            Arrays.asList(new BigDecimal[] { new BigDecimal(1.1d), null, new BigDecimal(2.2d) }),
            
            new BigInteger[] { new BigInteger("1"), null, new BigInteger("2") },
            Arrays.asList(new BigInteger[] { new BigInteger("1"), null, new BigInteger("2") }),
            
            new Date[] { new Date(), null, new Date() },
            Arrays.asList(new Date[] { new Date(), null, new Date() }),
            
            new Baz[] { new Baz(0, "0", 0), null, new Baz(1, "1", 1) },
            Arrays.asList(new Baz[] { new Baz(0, "0", 0), null, new Baz(1, "1", 1) })
    };
    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(objectArray);

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertArrayObjectEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertArrayObjectEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 10
Source File: NullArrayElementInObjectArrayTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public void testNullFirstAndLast() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    Object[] objectArray = new Object[] {
            new Boolean[] { null, true, false, null },
            Arrays.asList(new Boolean[] { null, true, false, null }),
            
            new Character[] { null, 'a', 'b', null },
            Arrays.asList(new Character[] { null, 'a', 'b', null }),
            
            new Short[] { null, 1, 2, null },
            Arrays.asList(new Short[] { null, 1, 2, null }),
            
            new Integer[] { null, 1, 2, null },
            Arrays.asList(new Integer[] { null, 1, 2, null }),
            
            new Long[] { null, 1l, 2l, null },
            Arrays.asList(new Long[] { null, 1l, 2l, null }),
            
            new Float[] { null, 1.1f, 2.2f, null },
            Arrays.asList(new Float[] { null, 1.1f, 2.2f, null }),
            
            new Double[] { null, 1.1d, 2.2d, null },
            Arrays.asList(new Double[] { null, 1.1d, 2.2d, null }),
            
            new String[] { null, "a", "b", null },
            Arrays.asList(new String[] { null, "a", "b", null }),
            
            new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null },
            Arrays.asList(new ByteString[] { null, ByteString.copyFromUtf8("a"), ByteString.copyFromUtf8("b"), null }),
            
            new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' }, null },
            Arrays.asList(new byte[][] { null, new byte[] { 'a' }, new byte[] { 'b' }, null }),
            
            new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d), null },
            Arrays.asList(new BigDecimal[] { null, new BigDecimal(1.1d), new BigDecimal(2.2d), null }),
            
            new BigInteger[] { null, new BigInteger("1"), new BigInteger("2"), null },
            Arrays.asList(new BigInteger[] { null, new BigInteger("1"), new BigInteger("2"), null }),
            
            new Date[] { null, new Date(), new Date(), null },
            Arrays.asList(new Date[] { null, new Date(), new Date(), null }),
            
            new Baz[] { null, new Baz(0, "0", 0), new Baz(1, "1", 1), null },
            Arrays.asList(new Baz[] { null, new Baz(0, "0", 0), new Baz(1, "1", 1), null })
    };
    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(objectArray);

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertArrayObjectEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertArrayObjectEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}
 
Example 11
Source File: NullArrayElementInObjectArrayTest.java    From protostuff with Apache License 2.0 4 votes vote down vote up
public void testNullInBetween() throws IOException
{
    Schema<PojoWithNonPrimitiveArrays> schema =
            getSchema(PojoWithNonPrimitiveArrays.class);

    Pipe.Schema<PojoWithNonPrimitiveArrays> pipeSchema =
            ((RuntimeSchema<PojoWithNonPrimitiveArrays>) schema).getPipeSchema();

    Object[] objectArray = new Object[] {
            new Boolean[] { null, true, null, false, null },
            Arrays.asList(new Boolean[] { null, true, null, false, null }),
            
            new Character[] { null, 'a', null, 'b', null },
            Arrays.asList(new Character[] { null, 'a', null, 'b', null }),
            
            new Short[] { null, 1, null, 2, null },
            Arrays.asList(new Short[] { null, 1, null, 2, null }),
            
            new Integer[] { null, 1, null, 2, null },
            Arrays.asList(new Integer[] { null, 1, null, 2, null }),
            
            new Long[] { null, 1l, null, 2l, null },
            Arrays.asList(new Long[] { null, 1l, null, 2l, null }),
            
            new Float[] { null, 1.1f, null, 2.2f, null },
            Arrays.asList(new Float[] { null, 1.1f, null, 2.2f, null }),
            
            new Double[] { null, 1.1d, null, 2.2d, null },
            Arrays.asList(new Double[] { null, 1.1d, null, 2.2d, null }),
            
            new String[] { null, "a", null, "b", null },
            Arrays.asList(new String[] { null, "a", null, "b", null }),
            
            new ByteString[] { null, ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b"), null },
            Arrays.asList(new ByteString[] { null, ByteString.copyFromUtf8("a"), null, ByteString.copyFromUtf8("b"), null }),
            
            new byte[][] { null, new byte[] { 'a' }, null, new byte[] { 'b' }, null },
            Arrays.asList(new byte[][] { null, new byte[] { 'a' }, null, new byte[] { 'b' }, null }),
            
            new BigDecimal[] { null, new BigDecimal(1.1d), null, new BigDecimal(2.2d), null },
            Arrays.asList(new BigDecimal[] { null, new BigDecimal(1.1d), null, new BigDecimal(2.2d), null }),
            
            new BigInteger[] { null, new BigInteger("1"), null, new BigInteger("2"), null },
            Arrays.asList(new BigInteger[] { null, new BigInteger("1"), null, new BigInteger("2"), null }),
            
            new Date[] { null, new Date(), null, new Date(), null },
            Arrays.asList(new Date[] { null, new Date(), null, new Date(), null }),
            
            new Baz[] { null, new Baz(0, "0", 0), null, new Baz(1, "1", 1), null },
            Arrays.asList(new Baz[] { null, new Baz(0, "0", 0), null, new Baz(1, "1", 1), null })
    };
    PojoWithNonPrimitiveArrays p = new PojoWithNonPrimitiveArrays(objectArray);

    byte[] data = toByteArray(p, schema);

    PojoWithNonPrimitiveArrays pFromByteArray = schema.newMessage();
    mergeFrom(data, 0, data.length, pFromByteArray, schema);
    assertArrayObjectEquals(p, pFromByteArray);

    PojoWithNonPrimitiveArrays pFromStream = schema.newMessage();
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    mergeFrom(in, pFromStream, schema);
    assertArrayObjectEquals(p, pFromStream);

    roundTrip(p, schema, pipeSchema);
}