Processor extends AnnotationProcessor { @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round) { if (round.getElementsAnnotatedWithAny(processor.annotations()).isEmpty()) { return false; } processor.initialize(round); processor.run(); if (!round.processingOver()) { yaml.write(environment.mappings); } return false; }  @Override void init(ProcessingEnvironment env); @Override boolean process(Set<? extends TypeElement> annotations, RoundEnvironment round);  }
@Test void process() { RoundEnvironment round = when(mock(RoundEnvironment.class).getElementsAnnotatedWithAny(any(Set.class))).thenReturn(Set.of(element)).getMock(); when(round.processingOver()).thenReturn(false); processor.processor = mock(StandaloneProcessor.class); processor.yaml = mock(StandaloneYAML.class); assertFalse(processor.process(Set.of(), round)); verify(processor.yaml).write(any()); }
@Test void process_over() { RoundEnvironment round = when(mock(RoundEnvironment.class).getElementsAnnotatedWithAny(any(Set.class))).thenReturn(Set.of(element)).getMock(); when(round.processingOver()).thenReturn(true); processor.processor = mock(StandaloneProcessor.class); processor.yaml = mock(StandaloneYAML.class); assertFalse(processor.process(Set.of(), round)); verify(processor.yaml, times(0)).write(any()); }
@Test void process_empty() { RoundEnvironment environment = when(mock(RoundEnvironment.class).getElementsAnnotatedWithAny(any(Set.class))).thenReturn(Set.of()).getMock(); processor.processor = mock(StandaloneProcessor.class); assertFalse(processor.process(Set.of(), environment)); verify(processor.processor, times(0)).initialize(any()); }