| 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 17 matching lines...) Expand all Loading... |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 package com.google.protobuf; | 31 package com.google.protobuf; |
| 32 | 32 |
| 33 import protobuf_unittest.UnittestProto.ForeignMessage; | 33 import protobuf_unittest.UnittestProto.ForeignMessage; |
| 34 import protobuf_unittest.UnittestProto.TestAllExtensions; | 34 import protobuf_unittest.UnittestProto.TestAllExtensions; |
| 35 import protobuf_unittest.UnittestProto.TestAllTypes; | 35 import protobuf_unittest.UnittestProto.TestAllTypes; |
| 36 import protobuf_unittest.UnittestProto.TestRequired; | 36 import protobuf_unittest.UnittestProto.TestRequired; |
| 37 import protobuf_unittest.UnittestProto.TestRequiredForeign; | 37 import protobuf_unittest.UnittestProto.TestRequiredForeign; |
| 38 | 38 import java.util.List; |
| 39 import junit.framework.TestCase; | 39 import junit.framework.TestCase; |
| 40 | 40 |
| 41 import java.util.List; | |
| 42 | |
| 43 /** | 41 /** |
| 44 * Misc. unit tests for message operations that apply to both generated | 42 * Misc. unit tests for message operations that apply to both generated |
| 45 * and dynamic messages. | 43 * and dynamic messages. |
| 46 * | 44 * |
| 47 * @author kenton@google.com Kenton Varda | 45 * @author kenton@google.com Kenton Varda |
| 48 */ | 46 */ |
| 49 public class MessageTest extends TestCase { | 47 public class MessageTest extends TestCase { |
| 50 // ================================================================= | 48 // ================================================================= |
| 51 // Message-merging tests. | 49 // Message-merging tests. |
| 52 | 50 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 DynamicMessage.newBuilder(TestAllTypes.getDescriptor()) | 342 DynamicMessage.newBuilder(TestAllTypes.getDescriptor()) |
| 345 .mergeFrom(DynamicMessage.newBuilder(REPEATED_NESTED).build()) | 343 .mergeFrom(DynamicMessage.newBuilder(REPEATED_NESTED).build()) |
| 346 .build(); | 344 .build(); |
| 347 | 345 |
| 348 assertTrue(result.getField(result.getDescriptorForType() | 346 assertTrue(result.getField(result.getDescriptorForType() |
| 349 .findFieldByName("repeated_foreign_message")) instanceof List<?>); | 347 .findFieldByName("repeated_foreign_message")) instanceof List<?>); |
| 350 assertEquals(result.getRepeatedFieldCount(result.getDescriptorForType() | 348 assertEquals(result.getRepeatedFieldCount(result.getDescriptorForType() |
| 351 .findFieldByName("repeated_foreign_message")), 2); | 349 .findFieldByName("repeated_foreign_message")), 2); |
| 352 } | 350 } |
| 353 } | 351 } |
| OLD | NEW |