@Test
public void valueFromAnnotation() {
Sub4EyesController contr = new Sub4EyesController();
Object o1 = AnnotationUtil.getValueOfAnnotatedFieldOrMethod(contr, XmlValue.class);
Assert.assertTrue((Long) o1 == 43);
Object o2 = AnnotationUtil.getValueOfAnnotatedFieldOrMethod(contr, XmlTransient.class);
Assert.assertTrue((Boolean) o2 == true);
ConfigurationTest test = new ConfigurationTest();
Object o4 = AnnotationUtil.getValueOfAnnotatedFieldOrMethod(test, AfterClass.class);
Assert.assertTrue(o4 == null);
try {
AnnotationUtil.getValueOfAnnotatedFieldOrMethod(contr, XmlSchemaType.class);
Assert.fail();
} catch (AnnotationNotFoundException e) {
// okay, annotation is not present
}
}
AnnotationUtilTest.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:cibet
作者:
评论列表
文章目录