| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 import protobuf_unittest.UnittestMset.TestMessageSetExtension2; | 37 import protobuf_unittest.UnittestMset.TestMessageSetExtension2; |
| 38 import protobuf_unittest.UnittestProto; | 38 import protobuf_unittest.UnittestProto; |
| 39 import protobuf_unittest.UnittestProto.TestAllExtensions; | 39 import protobuf_unittest.UnittestProto.TestAllExtensions; |
| 40 import protobuf_unittest.UnittestProto.TestAllTypes; | 40 import protobuf_unittest.UnittestProto.TestAllTypes; |
| 41 import protobuf_unittest.UnittestProto.TestFieldOrderings; | 41 import protobuf_unittest.UnittestProto.TestFieldOrderings; |
| 42 import protobuf_unittest.UnittestProto.TestOneof2; | 42 import protobuf_unittest.UnittestProto.TestOneof2; |
| 43 import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible; | 43 import protobuf_unittest.UnittestProto.TestOneofBackwardsCompatible; |
| 44 import protobuf_unittest.UnittestProto.TestPackedExtensions; | 44 import protobuf_unittest.UnittestProto.TestPackedExtensions; |
| 45 import protobuf_unittest.UnittestProto.TestPackedTypes; | 45 import protobuf_unittest.UnittestProto.TestPackedTypes; |
| 46 import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; | 46 import proto2_wireformat_unittest.UnittestMsetWireFormat.TestMessageSet; |
| 47 |
| 48 import junit.framework.TestCase; |
| 49 |
| 47 import java.io.ByteArrayInputStream; | 50 import java.io.ByteArrayInputStream; |
| 48 import java.io.ByteArrayOutputStream; | 51 import java.io.ByteArrayOutputStream; |
| 49 import java.util.List; | 52 import java.util.List; |
| 50 import junit.framework.TestCase; | |
| 51 | 53 |
| 52 /** | 54 /** |
| 53 * Tests related to parsing and serialization. | 55 * Tests related to parsing and serialization. |
| 54 * | 56 * |
| 55 * @author kenton@google.com (Kenton Varda) | 57 * @author kenton@google.com (Kenton Varda) |
| 56 */ | 58 */ |
| 57 public class WireFormatTest extends TestCase { | 59 public class WireFormatTest extends TestCase { |
| 58 public void testSerialization() throws Exception { | 60 public void testSerialization() throws Exception { |
| 59 TestAllTypes message = TestUtil.getAllSet(); | 61 TestAllTypes message = TestUtil.getAllSet(); |
| 60 | 62 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 public void testOneofOnlyLastSet() throws Exception { | 597 public void testOneofOnlyLastSet() throws Exception { |
| 596 TestOneofBackwardsCompatible source = TestOneofBackwardsCompatible | 598 TestOneofBackwardsCompatible source = TestOneofBackwardsCompatible |
| 597 .newBuilder().setFooInt(100).setFooString("101").build(); | 599 .newBuilder().setFooInt(100).setFooString("101").build(); |
| 598 | 600 |
| 599 ByteString rawBytes = source.toByteString(); | 601 ByteString rawBytes = source.toByteString(); |
| 600 TestOneof2 message = TestOneof2.parseFrom(rawBytes); | 602 TestOneof2 message = TestOneof2.parseFrom(rawBytes); |
| 601 assertFalse(message.hasFooInt()); | 603 assertFalse(message.hasFooInt()); |
| 602 assertTrue(message.hasFooString()); | 604 assertTrue(message.hasFooString()); |
| 603 } | 605 } |
| 604 } | 606 } |
| OLD | NEW |