Processor { public void run() { for (var parser : parsers) { var types = parser.annotations().stream().collect(flatMapping(this::annotated, toSet())); parser.parse(types); } } Processor(Environment<T> environment, PluginParser<T> parser);  Processor(Environment<T> environment, List<Parser<T>> parsers); static ClassLoader loader(List<String> classpaths); void run(); Set<Class<? extends Annotation>> annotations();  }
@Test void run() { assertEquals(6, processor.parsers.size()); Parser<Class<?>> parser = when(mock(Parser.class).annotations()).thenReturn(Set.of(Test.class)).getMock(); processor.parsers = List.of(parser); processor.run(); verify(parser).parse(Set.of(StubProcessor.class)); }