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