| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 package com.google.protobuf; | 31 package com.google.protobuf; |
| 32 | 32 |
| 33 import com.google.protobuf.Descriptors.EnumDescriptor; | 33 import com.google.protobuf.Descriptors.EnumDescriptor; |
| 34 import com.google.protobuf.Descriptors.FieldDescriptor; | 34 import com.google.protobuf.Descriptors.FieldDescriptor; |
| 35 import com.google.protobuf.Descriptors.OneofDescriptor; | 35 import com.google.protobuf.Descriptors.OneofDescriptor; |
| 36 import protobuf_unittest.UnittestProto.TestAllExtensions; | 36 import protobuf_unittest.UnittestProto.TestAllExtensions; |
| 37 import protobuf_unittest.UnittestProto.TestAllTypes; | 37 import protobuf_unittest.UnittestProto.TestAllTypes; |
| 38 import protobuf_unittest.UnittestProto.TestEmptyMessage; | 38 import protobuf_unittest.UnittestProto.TestEmptyMessage; |
| 39 import protobuf_unittest.UnittestProto.TestPackedTypes; | 39 import protobuf_unittest.UnittestProto.TestPackedTypes; |
| 40 |
| 41 import junit.framework.TestCase; |
| 42 |
| 40 import java.util.Arrays; | 43 import java.util.Arrays; |
| 41 import junit.framework.TestCase; | |
| 42 | 44 |
| 43 /** | 45 /** |
| 44 * Unit test for {@link DynamicMessage}. See also {@link MessageTest}, which | 46 * Unit test for {@link DynamicMessage}. See also {@link MessageTest}, which |
| 45 * tests some {@link DynamicMessage} functionality. | 47 * tests some {@link DynamicMessage} functionality. |
| 46 * | 48 * |
| 47 * @author kenton@google.com Kenton Varda | 49 * @author kenton@google.com Kenton Varda |
| 48 */ | 50 */ |
| 49 public class DynamicMessageTest extends TestCase { | 51 public class DynamicMessageTest extends TestCase { |
| 50 TestUtil.ReflectionTester reflectionTester = | 52 TestUtil.ReflectionTester reflectionTester = |
| 51 new TestUtil.ReflectionTester(TestAllTypes.getDescriptor(), null); | 53 new TestUtil.ReflectionTester(TestAllTypes.getDescriptor(), null); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 FieldDescriptor repeatedEnumField = | 317 FieldDescriptor repeatedEnumField = |
| 316 TestAllTypes.getDescriptor().findFieldByName( | 318 TestAllTypes.getDescriptor().findFieldByName( |
| 317 "repeated_nested_enum"); | 319 "repeated_nested_enum"); |
| 318 EnumDescriptor enumDescriptor = TestAllTypes.NestedEnum.getDescriptor(); | 320 EnumDescriptor enumDescriptor = TestAllTypes.NestedEnum.getDescriptor(); |
| 319 builder.setField(repeatedEnumField, enumDescriptor.getValues()); | 321 builder.setField(repeatedEnumField, enumDescriptor.getValues()); |
| 320 DynamicMessage message = builder.build(); | 322 DynamicMessage message = builder.build(); |
| 321 assertEquals( | 323 assertEquals( |
| 322 enumDescriptor.getValues(), message.getField(repeatedEnumField)); | 324 enumDescriptor.getValues(), message.getField(repeatedEnumField)); |
| 323 } | 325 } |
| 324 } | 326 } |
| OLD | NEW |