32
32
import javax .annotation .Nonnull ;
33
33
import javax .annotation .ParametersAreNonnullByDefault ;
34
34
import javax .annotation .Resource ;
35
+ import javax .annotation .meta .When ;
35
36
36
37
import org .junit .Ignore ;
37
38
import org .junit .Rule ;
@@ -198,7 +199,7 @@ public void getAllAnnotationAttributesOnNonAnnotatedClass() {
198
199
public void getAllAnnotationAttributesOnClassWithLocalAnnotation () {
199
200
MultiValueMap <String , Object > attributes = getAllAnnotationAttributes (TxConfig .class , TX_NAME );
200
201
assertNotNull ("Annotation attributes map for @Transactional on TxConfig" , attributes );
201
- assertEquals ("value for TxConfig. " , asList ("TxConfig" ), attributes .get ("value" ));
202
+ assertEquals ("value for TxConfig" , asList ("TxConfig" ), attributes .get ("value" ));
202
203
}
203
204
204
205
@ Test
@@ -234,7 +235,7 @@ public void getAllAnnotationAttributesFavorsInheritedComposedAnnotationsOverMore
234
235
public void getAllAnnotationAttributesOnClassWithLocalAnnotationThatShadowsAnnotationFromSuperclass () {
235
236
MultiValueMap <String , Object > attributes = getAllAnnotationAttributes (DerivedTxConfig .class , TX_NAME );
236
237
assertNotNull ("Annotation attributes map for @Transactional on DerivedTxConfig" , attributes );
237
- assertEquals ("value for DerivedTxConfig. " , asList ("DerivedTxConfig" ), attributes .get ("value" ));
238
+ assertEquals ("value for DerivedTxConfig" , asList ("DerivedTxConfig" ), attributes .get ("value" ));
238
239
}
239
240
240
241
/**
@@ -249,13 +250,29 @@ public void getAllAnnotationAttributesOnClassWithMultipleComposedAnnotations() {
249
250
attributes .get ("value" ));
250
251
}
251
252
253
+ @ Test
254
+ public void getAllAnnotationAttributesOnLangType () {
255
+ MultiValueMap <String , Object > attributes = getAllAnnotationAttributes (
256
+ NonNullApi .class , Nonnull .class .getName ());
257
+ assertNotNull ("Annotation attributes map for @Nonnull on NonNullApi" , attributes );
258
+ assertEquals ("value for NonNullApi" , asList (When .ALWAYS ), attributes .get ("when" ));
259
+ }
260
+
261
+ @ Test
262
+ public void getAllAnnotationAttributesOnJavaxType () {
263
+ MultiValueMap <String , Object > attributes = getAllAnnotationAttributes (
264
+ ParametersAreNonnullByDefault .class , Nonnull .class .getName ());
265
+ assertNotNull ("Annotation attributes map for @Nonnull on NonNullApi" , attributes );
266
+ assertEquals ("value for NonNullApi" , asList (When .ALWAYS ), attributes .get ("when" ));
267
+ }
268
+
252
269
@ Test
253
270
public void getMergedAnnotationAttributesOnClassWithLocalAnnotation () {
254
271
Class <?> element = TxConfig .class ;
255
272
String name = TX_NAME ;
256
273
AnnotationAttributes attributes = getMergedAnnotationAttributes (element , name );
257
274
assertNotNull ("Annotation attributes for @Transactional on TxConfig" , attributes );
258
- assertEquals ("value for TxConfig. " , "TxConfig" , attributes .getString ("value" ));
275
+ assertEquals ("value for TxConfig" , "TxConfig" , attributes .getString ("value" ));
259
276
// Verify contracts between utility methods:
260
277
assertTrue (isAnnotated (element , name ));
261
278
}
@@ -266,7 +283,7 @@ public void getMergedAnnotationAttributesOnClassWithLocalAnnotationThatShadowsAn
266
283
String name = TX_NAME ;
267
284
AnnotationAttributes attributes = getMergedAnnotationAttributes (element , name );
268
285
assertNotNull ("Annotation attributes for @Transactional on DerivedTxConfig" , attributes );
269
- assertEquals ("value for DerivedTxConfig. " , "DerivedTxConfig" , attributes .getString ("value" ));
286
+ assertEquals ("value for DerivedTxConfig" , "DerivedTxConfig" , attributes .getString ("value" ));
270
287
// Verify contracts between utility methods:
271
288
assertTrue (isAnnotated (element , name ));
272
289
}
0 commit comments