| 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 | |
| 50 import java.io.ByteArrayInputStream; | 47 import java.io.ByteArrayInputStream; |
| 51 import java.io.ByteArrayOutputStream; | 48 import java.io.ByteArrayOutputStream; |
| 52 import java.util.List; | 49 import java.util.List; |
| 50 import junit.framework.TestCase; |
| 53 | 51 |
| 54 /** | 52 /** |
| 55 * Tests related to parsing and serialization. | 53 * Tests related to parsing and serialization. |
| 56 * | 54 * |
| 57 * @author kenton@google.com (Kenton Varda) | 55 * @author kenton@google.com (Kenton Varda) |
| 58 */ | 56 */ |
| 59 public class WireFormatTest extends TestCase { | 57 public class WireFormatTest extends TestCase { |
| 60 public void testSerialization() throws Exception { | 58 public void testSerialization() throws Exception { |
| 61 TestAllTypes message = TestUtil.getAllSet(); | 59 TestAllTypes message = TestUtil.getAllSet(); |
| 62 | 60 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 public void testOneofOnlyLastSet() throws Exception { | 595 public void testOneofOnlyLastSet() throws Exception { |
| 598 TestOneofBackwardsCompatible source = TestOneofBackwardsCompatible | 596 TestOneofBackwardsCompatible source = TestOneofBackwardsCompatible |
| 599 .newBuilder().setFooInt(100).setFooString("101").build(); | 597 .newBuilder().setFooInt(100).setFooString("101").build(); |
| 600 | 598 |
| 601 ByteString rawBytes = source.toByteString(); | 599 ByteString rawBytes = source.toByteString(); |
| 602 TestOneof2 message = TestOneof2.parseFrom(rawBytes); | 600 TestOneof2 message = TestOneof2.parseFrom(rawBytes); |
| 603 assertFalse(message.hasFooInt()); | 601 assertFalse(message.hasFooInt()); |
| 604 assertTrue(message.hasFooString()); | 602 assertTrue(message.hasFooString()); |
| 605 } | 603 } |
| 606 } | 604 } |
| OLD | NEW |