BehaviorProcessor extends ProcessorBase implements CdkAnnotationProcessor { @Override public void process(Element element, ComponentLibrary library) throws CdkProcessingException { SourceUtils sourceUtils = getSourceUtils(); AnnotationMirror behavior = sourceUtils.getAnnotationMirror(element, JsfBehavior.class); BehaviorModel behaviorModel = new BehaviorModel(); sourceUtils.setModelProperty(behaviorModel, behavior, "id"); setClassNames((TypeElement) element, behaviorModel, behavior); setTagInfo(behavior, behaviorModel); processAttributes((TypeElement) element, behaviorModel, behavior); setDescription(behaviorModel, behavior, getDocComment(element)); if (!sourceUtils.isDefaultValue(behavior, "renderer")) { AnnotationMirror renderer = sourceUtils.getAnnotationValue(behavior, "renderer", AnnotationMirror.class); sourceUtils.setModelProperty(behaviorModel, renderer, "rendererType", "type"); } library.getBehaviors().add(behaviorModel); }  @Override void process(Element element, ComponentLibrary library); @Override Class<? extends Annotation> getProcessedAnnotation();  }
@Test @Ignore public void testProcess() throws Exception { expect(componentElement.getAnnotation(JsfBehavior.class)).andStubReturn(behaviorAnnotation); expect(behaviorAnnotation.id()).andReturn(MY_BEHAVIOR); expect(componentElement.getQualifiedName()).andReturn(name); expect(componentElement.getModifiers()).andReturn(Collections.singleton(Modifier.ABSTRACT)); expect(componentElement.getQualifiedName()).andReturn(name).atLeastOnce(); expect(behaviorAnnotation.generate()).andReturn("foo.Bar"); expect(behaviorAnnotation.tag()).andReturn(new Tag[] { tag }); expect(behaviorAnnotation.attributes()).andReturn(new String[] {}); expect(behaviorAnnotation.description()).andReturn(this.description); expect(tag.handler()).andStubReturn(""); utils.visitSupertypes((TypeElement) anyObject(), (SuperTypeVisitor) anyObject()); expectLastCall(); expect(utils.getBeanPropertiesAnnotatedWith(eq(Attribute.class), (TypeElement) anyObject())).andReturn( Collections.<BeanProperty>emptySet()); expect(utils.getDocComment((TypeElement) anyObject())).andStubReturn(null); replay(log, utils, componentElement, jaxb, conventions, behaviorAnnotation, tag, name); processor.process(componentElement, library); verify(log, utils, componentElement, jaxb, conventions, behaviorAnnotation, tag, name); Collection<BehaviorModel> behaviors = library.getBehaviors(); assertEquals(1, behaviors.size()); for (BehaviorModel model : behaviors) { FacesId id = model.getId(); if (id != null) { assertEquals(MY_BEHAVIOR, id.toString()); } } }