private static void assertGoodTesterAnnotation(Class<? extends Annotation> annotationClass) {
assertNotNull(
rootLocaleFormat("%s must be annotated with @TesterAnnotation.", annotationClass),
annotationClass.getAnnotation(TesterAnnotation.class));
final Retention retentionPolicy = annotationClass.getAnnotation(Retention.class);
assertNotNull(
rootLocaleFormat("%s must have a @Retention annotation.", annotationClass),
retentionPolicy);
assertEquals(
rootLocaleFormat("%s must have RUNTIME RetentionPolicy.", annotationClass),
RetentionPolicy.RUNTIME,
retentionPolicy.value());
assertNotNull(
rootLocaleFormat("%s must be inherited.", annotationClass),
annotationClass.getAnnotation(Inherited.class));
for (String propertyName : new String[] {"value", "absent"}) {
Method method = null;
try {
method = annotationClass.getMethod(propertyName);
} catch (NoSuchMethodException e) {
fail(
rootLocaleFormat("%s must have a property named '%s'.", annotationClass, propertyName));
}
final Class<?> returnType = method.getReturnType();
assertTrue(
rootLocaleFormat("%s.%s() must return an array.", annotationClass, propertyName),
returnType.isArray());
assertSame(
rootLocaleFormat(
"%s.%s() must return an array of %s.",
annotationClass, propertyName, annotationClass.getDeclaringClass()),
annotationClass.getDeclaringClass(),
returnType.getComponentType());
}
}
FeatureEnumTest.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:guava
作者:
评论列表
文章目录