assertEquals(UnsupportedAnnotation.class, unprocessed[0]
.annotationType());
}
public void testProcessAnnotation() {
BaseAnnotationProcessingService baps = new BaseAnnotationProcessingService();
baps.addAnnotationProcessor(new SupportedAnnotationProcessor());
MyPropertyHolder holder = new MyPropertyHolder();
holder.addNature(BaseNature.class.getName());
BaseNature info = new BaseNature(holder) {
public String getId() {
return BaseNature.class.getName();
}
};
/*
* our AnnotationHolder has 2 Annotations: @UnsupportedAnnotation and
*
* @SupportedAnnotation, so we get them
*/
Annotation unsupportedAnnotation = AnnotationHolder.class
.getAnnotation(UnsupportedAnnotation.class);
Annotation supportedAnnotation = AnnotationHolder.class
.getAnnotation(SupportedAnnotation.class);
assertNotNull(unsupportedAnnotation);
assertNotNull(supportedAnnotation);
/*
* we know, that we don't have processor for @UnsupportedAnnotation, so
* processing it will return false.
*/
assertFalse(baps.processAnnotation(info, unsupportedAnnotation));
assertTrue(baps.processAnnotation(info, supportedAnnotation));
}