public void testPartialEmptyFooWithEmptyString() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); ArrayList<String> strings = new ArrayList<String>(); strings.add(""); foo.setSomeString(strings); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooWithEmptyString() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); ArrayList<String> strings = new ArrayList<String>(); strings.add(""); foo.setSomeString(strings); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooWithString() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); ArrayList<String> strings = new ArrayList<String>(); strings.add("someString"); foo.setSomeString(strings); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooWithString() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); ArrayList<String> strings = new ArrayList<String>(); strings.add("someString"); foo.setSomeString(strings); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testFoo() throws Exception { Bar bar = new Bar(); bar.setSomeInt(1); bar.setSomeBytes(ByteString.copyFromUtf8(ESCAPE_TARGET)); bar.setSomeString(ESCAPE_TARGET); ArrayList<Bar> bars = new ArrayList<Bar>(); bars.add(bar); bars.add(bar); ArrayList<String> strings = new ArrayList<String>(); strings.add(ESCAPE_TARGET); strings.add(""); strings.add(ESCAPE_TARGET); Foo foo = new Foo(); foo.setSomeBar(bars); foo.setSomeString(strings); byte[] protostuff = ProtostuffIOUtil.toByteArray(foo, foo.cachedSchema(), buf()); byte[] json = JsonIOUtil.toByteArray(ProtostuffIOUtil.newPipe(protostuff), Foo.getPipeSchema(), false); byte[] json2 = JsonXIOUtil.toByteArray(ProtostuffIOUtil.newPipe(protostuff), Foo.getPipeSchema(), false, buf()); assertTrue(json.length == json2.length); String strJson = STRING.deser(json); String strJson2 = STRING.deser(json2); assertEquals(strJson, strJson2); System.err.println(strJson); System.err.println(strJson2); }