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 13 matching lines...) Expand all Loading... |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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.TestDeprecatedFields; | 33 import protobuf_unittest.UnittestProto.TestDeprecatedFields; |
34 | |
35 import junit.framework.TestCase; | |
36 | |
37 import java.lang.reflect.AnnotatedElement; | 34 import java.lang.reflect.AnnotatedElement; |
38 import java.lang.reflect.Method; | 35 import java.lang.reflect.Method; |
| 36 import junit.framework.TestCase; |
39 | 37 |
40 /** | 38 /** |
41 * Test field deprecation | 39 * Test field deprecation |
42 * | 40 * |
43 * @author birdo@google.com (Roberto Scaramuzzi) | 41 * @author birdo@google.com (Roberto Scaramuzzi) |
44 */ | 42 */ |
45 public class DeprecatedFieldTest extends TestCase { | 43 public class DeprecatedFieldTest extends TestCase { |
46 private String[] deprecatedGetterNames = { | 44 private String[] deprecatedGetterNames = { |
47 "hasDeprecatedInt32", | 45 "hasDeprecatedInt32", |
48 "getDeprecatedInt32"}; | 46 "getDeprecatedInt32"}; |
(...skipping 23 matching lines...) Expand all Loading... |
72 Method method = deprecatedFieldsBuilder.getMethod(name, int.class); | 70 Method method = deprecatedFieldsBuilder.getMethod(name, int.class); |
73 assertTrue("Method " + name + " should be deprecated", | 71 assertTrue("Method " + name + " should be deprecated", |
74 isDeprecated(method)); | 72 isDeprecated(method)); |
75 } | 73 } |
76 } | 74 } |
77 | 75 |
78 private boolean isDeprecated(AnnotatedElement annotated) { | 76 private boolean isDeprecated(AnnotatedElement annotated) { |
79 return annotated.isAnnotationPresent(Deprecated.class); | 77 return annotated.isAnnotationPresent(Deprecated.class); |
80 } | 78 } |
81 } | 79 } |
OLD | NEW |