@Test @SuppressWarnings("unchecked") public void testMultipleSVGViewFactories() throws Exception { types.add(makeTypeElement("Factory1")); types.add(makeTypeElement("Factory2")); when(roundEnvironment.errorRaised()).thenReturn(false); when(roundEnvironment.getElementsAnnotatedWith(SVGViewFactoryAnnotation)).thenReturn(types); when(elements.getTypeElement(SVGShapeProcessor.ANNOTATION_SVGSHAPE_VIEW_FACTORY)).thenReturn(SVGViewFactoryAnnotation); when(roundEnvironment.processingOver()).thenReturn(false); processor.processWithExceptions(elementTypes, roundEnvironment); when(roundEnvironment.processingOver()).thenReturn(true); processor.processWithExceptions(elementTypes, roundEnvironment); verify(filer, times(2)).createSourceFile(generatedSourceFileNames.capture()); assertContains(this.getClass().getPackage().getName() + ".Factory1Impl"); assertContains(this.getClass().getPackage().getName() + ".Factory2Impl"); }
@Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } if (roundEnv.errorRaised()) { return false; } generator = SVGGeneratorFactory.newGenerator(); final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; }
SVGShapeProcessor extends AbstractErrorAbsorbingProcessor { @Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } if (roundEnv.errorRaised()) { return false; } generator = SVGGeneratorFactory.newGenerator(); final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; } }
SVGShapeProcessor extends AbstractErrorAbsorbingProcessor { @Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } if (roundEnv.errorRaised()) { return false; } generator = SVGGeneratorFactory.newGenerator(); final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; }  }
SVGShapeProcessor extends AbstractErrorAbsorbingProcessor { @Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } if (roundEnv.errorRaised()) { return false; } generator = SVGGeneratorFactory.newGenerator(); final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; }   }
SVGShapeProcessor extends AbstractErrorAbsorbingProcessor { @Override protected boolean processWithExceptions(Set<? extends TypeElement> set, RoundEnvironment roundEnv) throws Exception { if (roundEnv.processingOver()) { return processLastRound(set, roundEnv); } if (roundEnv.errorRaised()) { return false; } generator = SVGGeneratorFactory.newGenerator(); final Elements elementUtils = processingEnv.getElementUtils(); for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ANNOTATION_SVGSHAPE_VIEW_FACTORY))) { processSvgShapeViewFactory(set, e, roundEnv); } return true; }   final static String ANNOTATION_SVGSHAPE_VIEW_FACTORY; }