SingleParser extends Parser<T> { @Override protected void check(Set<T> types) { if (types.size() > 1) { for (var type : types) { environment.error(type, "Project contains " + types.size() + " @" + name + " annotations, should contain one @" + name + " annotation"); } } } SingleParser(Environment environment, Set<Class<? extends Annotation>> annotations, String name);   }
@Test void check_one() { resolver.check(Set.of("a")); verifyNoInteractions(environment); }
@Test void check_many() { resolver.check(Set.of("a", "b")); verify(environment).error("a", "Project contains 2 @hello annotations, should contain one @hello annotation"); verify(environment).error("a", "Project contains 2 @hello annotations, should contain one @hello annotation"); }