54
54
* @author Sam Brannen
55
55
* @author Chris Beams
56
56
* @author Phillip Webb
57
+ * @author Oleg Zhurakousky
57
58
*/
58
59
public class AnnotationUtilsTests {
59
60
@@ -90,7 +91,7 @@ public void findMethodAnnotationOnLeaf() throws Exception {
90
91
assertNotNull (findAnnotation (m , Order .class ));
91
92
}
92
93
93
- /** @since 4.2 */
94
+ // @since 4.2
94
95
@ Test
95
96
public void findMethodAnnotationWithAnnotationOnMethodInInterface () throws Exception {
96
97
Method m = Leaf .class .getMethod ("fromInterfaceImplementedByRoot" );
@@ -102,7 +103,7 @@ public void findMethodAnnotationWithAnnotationOnMethodInInterface() throws Excep
102
103
assertNotNull (findAnnotation (m , Order .class ));
103
104
}
104
105
105
- /** @since 4.2 */
106
+ // @since 4.2
106
107
@ Test
107
108
public void findMethodAnnotationWithMetaAnnotationOnLeaf () throws Exception {
108
109
Method m = Leaf .class .getMethod ("metaAnnotatedOnLeaf" );
@@ -111,7 +112,7 @@ public void findMethodAnnotationWithMetaAnnotationOnLeaf() throws Exception {
111
112
assertNotNull (findAnnotation (m , Order .class ));
112
113
}
113
114
114
- /** @since 4.2 */
115
+ // @since 4.2
115
116
@ Test
116
117
public void findMethodAnnotationWithMetaMetaAnnotationOnLeaf () throws Exception {
117
118
Method m = Leaf .class .getMethod ("metaMetaAnnotatedOnLeaf" );
@@ -128,7 +129,7 @@ public void findMethodAnnotationOnRoot() throws Exception {
128
129
assertNotNull (findAnnotation (m , Order .class ));
129
130
}
130
131
131
- /** @since 4.2 */
132
+ // @since 4.2
132
133
@ Test
133
134
public void findMethodAnnotationWithMetaAnnotationOnRoot () throws Exception {
134
135
Method m = Leaf .class .getMethod ("metaAnnotatedOnRoot" );
@@ -258,42 +259,42 @@ public void findClassAnnotationOnMetaCycleAnnotatedClassWithMissingTargetMetaAnn
258
259
assertNull ("Should not find @Component on MetaCycleAnnotatedClass" , component );
259
260
}
260
261
261
- /** @since 4.2 */
262
+ // @since 4.2
262
263
@ Test
263
264
public void findClassAnnotationOnInheritedAnnotationInterface () {
264
265
Transactional tx = findAnnotation (InheritedAnnotationInterface .class , Transactional .class );
265
266
assertNotNull ("Should find @Transactional on InheritedAnnotationInterface" , tx );
266
267
}
267
268
268
- /** @since 4.2 */
269
+ // @since 4.2
269
270
@ Test
270
271
public void findClassAnnotationOnSubInheritedAnnotationInterface () {
271
272
Transactional tx = findAnnotation (SubInheritedAnnotationInterface .class , Transactional .class );
272
273
assertNotNull ("Should find @Transactional on SubInheritedAnnotationInterface" , tx );
273
274
}
274
275
275
- /** @since 4.2 */
276
+ // @since 4.2
276
277
@ Test
277
278
public void findClassAnnotationOnSubSubInheritedAnnotationInterface () {
278
279
Transactional tx = findAnnotation (SubSubInheritedAnnotationInterface .class , Transactional .class );
279
280
assertNotNull ("Should find @Transactional on SubSubInheritedAnnotationInterface" , tx );
280
281
}
281
282
282
- /** @since 4.2 */
283
+ // @since 4.2
283
284
@ Test
284
285
public void findClassAnnotationOnNonInheritedAnnotationInterface () {
285
286
Order order = findAnnotation (NonInheritedAnnotationInterface .class , Order .class );
286
287
assertNotNull ("Should find @Order on NonInheritedAnnotationInterface" , order );
287
288
}
288
289
289
- /** @since 4.2 */
290
+ // @since 4.2
290
291
@ Test
291
292
public void findClassAnnotationOnSubNonInheritedAnnotationInterface () {
292
293
Order order = findAnnotation (SubNonInheritedAnnotationInterface .class , Order .class );
293
294
assertNotNull ("Should find @Order on SubNonInheritedAnnotationInterface" , order );
294
295
}
295
296
296
- /** @since 4.2 */
297
+ // @since 4.2
297
298
@ Test
298
299
public void findClassAnnotationOnSubSubNonInheritedAnnotationInterface () {
299
300
Order order = findAnnotation (SubSubNonInheritedAnnotationInterface .class , Order .class );
@@ -1240,6 +1241,11 @@ public void synthesizeAnnotationFromDefaultsWithAttributeAliases() throws Except
1240
1241
assertEquals ("location: " , "" , contextConfig .location ());
1241
1242
}
1242
1243
1244
+ @ Test (expected = AnnotationConfigurationException .class )
1245
+ public void synthesizeAnnotationWithAttributeAliasesDifferentValues () throws Exception {
1246
+ getValue (synthesizeAnnotation (ContextConfigMismatch .class .getAnnotation (ContextConfig .class )));
1247
+ }
1248
+
1243
1249
@ Test
1244
1250
public void synthesizeAnnotationFromMapWithMinimalAttributesWithAttributeAliases () throws Exception {
1245
1251
Map <String , Object > map = Collections .singletonMap ("location" , "test.xml" );
@@ -1357,11 +1363,6 @@ public void toStringForSynthesizedAnnotations() throws Exception {
1357
1363
assertNotNull (synthesizedWebMapping2 );
1358
1364
1359
1365
assertThat (webMappingWithAliases .toString (), is (not (synthesizedWebMapping1 .toString ())));
1360
-
1361
- // The unsynthesized annotation for handleMappedWithSamePathAndValueAttributes()
1362
- // should produce the same toString() results as synthesized annotations for
1363
- // handleMappedWithPathAttribute()
1364
- assertToStringForWebMappingWithPathAndValue (webMappingWithPathAndValue );
1365
1366
assertToStringForWebMappingWithPathAndValue (synthesizedWebMapping1 );
1366
1367
assertToStringForWebMappingWithPathAndValue (synthesizedWebMapping2 );
1367
1368
}
@@ -1819,13 +1820,13 @@ public void foo() {
1819
1820
interface InterfaceWithRepeated {
1820
1821
1821
1822
@ MyRepeatable ("A" )
1822
- @ MyRepeatableContainer ({ @ MyRepeatable ("B" ), @ MyRepeatable ("C" ) })
1823
+ @ MyRepeatableContainer ({@ MyRepeatable ("B" ), @ MyRepeatable ("C" )})
1823
1824
@ MyRepeatableMeta1
1824
1825
void foo ();
1825
1826
}
1826
1827
1827
1828
@ MyRepeatable ("A" )
1828
- @ MyRepeatableContainer ({ @ MyRepeatable ("B" ), @ MyRepeatable ("C" ) })
1829
+ @ MyRepeatableContainer ({@ MyRepeatable ("B" ), @ MyRepeatable ("C" )})
1829
1830
@ MyRepeatableMeta1
1830
1831
static class MyRepeatableClass {
1831
1832
}
@@ -1834,7 +1835,7 @@ static class SubMyRepeatableClass extends MyRepeatableClass {
1834
1835
}
1835
1836
1836
1837
@ MyRepeatable ("X" )
1837
- @ MyRepeatableContainer ({ @ MyRepeatable ("Y" ), @ MyRepeatable ("Z" ) })
1838
+ @ MyRepeatableContainer ({@ MyRepeatable ("Y" ), @ MyRepeatable ("Z" )})
1838
1839
@ MyRepeatableMeta2
1839
1840
static class SubMyRepeatableWithAdditionalLocalDeclarationsClass extends MyRepeatableClass {
1840
1841
}
@@ -1964,7 +1965,7 @@ public void handleMappedWithDifferentPathAndValueAttributes() {
1964
1965
BrokenContextConfig [] value ();
1965
1966
}
1966
1967
1967
- @ Hierarchy ({ @ ContextConfig ("A" ), @ ContextConfig (location = "B" ) })
1968
+ @ Hierarchy ({@ ContextConfig ("A" ), @ ContextConfig (location = "B" )})
1968
1969
static class ConfigHierarchyTestCase {
1969
1970
}
1970
1971
@@ -2316,7 +2317,7 @@ static class TransitiveImplicitAliasesForAliasPairContextConfigClass {
2316
2317
Filter [] excludeFilters () default {};
2317
2318
}
2318
2319
2319
- @ ComponentScan (excludeFilters = { @ Filter (pattern = "*Foo" ), @ Filter (pattern = "*Bar" ) })
2320
+ @ ComponentScan (excludeFilters = {@ Filter (pattern = "*Foo" ), @ Filter (pattern = "*Bar" )})
2320
2321
static class ComponentScanClass {
2321
2322
}
2322
2323
@@ -2344,4 +2345,8 @@ static class ComponentScanSingleFilterClass {
2344
2345
String text ();
2345
2346
}
2346
2347
2348
+ @ ContextConfig (value = "foo" , location = "bar" )
2349
+ interface ContextConfigMismatch {
2350
+ }
2351
+
2347
2352
}
0 commit comments