~ubuntu-branches/debian/experimental/protobuf/experimental

« back to all changes in this revision

Viewing changes to java/src/test/java/com/google/protobuf/WireFormatTest.java

  • Committer: Package Import Robot
  • Author(s): Robert S. Edmonds
  • Date: 2014-09-02 16:57:20 UTC
  • mfrom: (1.3.2) (10.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140902165720-iafc3f2orkn6i76v
Tags: 2.6.0-1
* New upstream release.
* Upload to experimental.
* Switch to dh sequencer in debian/rules.
* Bump ABI version from 8 to 9.
* Drop all patches from debian/patches/:
  - arm_optimization.diff
      (Appears to be no longer needed.)
  - disable-setuptools-download.diff
      (Disable ez_setup entirely, rather than disabling the downloader
      component inside ez_setup.)
  - fix-ftbfs-gcc4.7-kfreebsd.patch
      (Fixed upstream.)
  - fix-ftbfs-upstream-issue-488.patch
      (Fixed upstream.)
  - revert_upstream_issue_388_about_rpath.diff
      (Fixed upstream.)
* Use dh-autoreconf. (Closes: #725976.)
* Enable the new C++-based Python extension module shipped in 2.6.0.
  See /usr/share/doc/python-protobuf/README.Debian for details.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
import protobuf_unittest.UnittestProto.TestAllExtensions;
41
41
import protobuf_unittest.UnittestProto.TestAllTypes;
42
42
import protobuf_unittest.UnittestProto.TestFieldOrderings;
 
43
import protobuf_unittest.UnittestProto.TestOneof2;
 
44
import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible;
43
45
import protobuf_unittest.UnittestProto.TestPackedExtensions;
44
46
import protobuf_unittest.UnittestProto.TestPackedTypes;
45
47
import protobuf_unittest.UnittestMset.TestMessageSet;
218
220
  }
219
221
 
220
222
  public void testExtensionsSerializedSize() throws Exception {
221
 
    assertEquals(TestUtil.getAllSet().getSerializedSize(),
222
 
                 TestUtil.getAllExtensionsSet().getSerializedSize());
 
223
    assertNotSame(TestUtil.getAllSet().getSerializedSize(),
 
224
                  TestUtil.getAllExtensionsSet().getSerializedSize());
223
225
  }
224
226
 
225
227
  public void testSerializeDelimited() throws Exception {
577
579
    assertEquals(123, messageSet.getExtension(
578
580
        TestMessageSetExtension1.messageSetExtension).getI());
579
581
  }
 
582
 
 
583
  // ================================================================
 
584
  // oneof
 
585
  public void testOneofWireFormat() throws Exception {
 
586
    TestOneof2.Builder builder = TestOneof2.newBuilder();
 
587
    TestUtil.setOneof(builder);
 
588
    TestOneof2 message = builder.build();
 
589
    ByteString rawBytes = message.toByteString();
 
590
 
 
591
    assertEquals(rawBytes.size(), message.getSerializedSize());
 
592
 
 
593
    TestOneof2 message2 = TestOneof2.parseFrom(rawBytes);
 
594
    TestUtil.assertOneofSet(message2);
 
595
  }
 
596
 
 
597
  public void testOneofOnlyLastSet() throws Exception {
 
598
    TestOneofBackwardsCompatible source = TestOneofBackwardsCompatible
 
599
        .newBuilder().setFooInt(100).setFooString("101").build();
 
600
 
 
601
    ByteString rawBytes = source.toByteString();
 
602
    TestOneof2 message = TestOneof2.parseFrom(rawBytes);
 
603
    assertFalse(message.hasFooInt());
 
604
    assertTrue(message.hasFooString());
 
605
  }
580
606
}