CheckMojo extends AbstractQuliceMojo { public void setValidatorsProvider(final ValidatorsProvider prov) { this.provider = prov; }  @Override void doExecute(); void setValidatorsProvider(final ValidatorsProvider prov);  }
@Test public void validatesUsingAllProvidedValidators() throws Exception { final CheckMojo mojo = new CheckMojo(); final Validator external = Mockito.mock(Validator.class); Mockito.when(external.name()).thenReturn("somename"); final ResourceValidator rexternal = Mockito.mock(ResourceValidator.class); Mockito.when(rexternal.name()).thenReturn("other"); final MavenValidator internal = Mockito.mock(MavenValidator.class); final ValidatorsProvider provider = new ValidatorsProviderMocker() .withInternal(internal) .withExternal(external) .withExternalResource(rexternal) .mock(); mojo.setValidatorsProvider(provider); final MavenProject project = Mockito.mock(MavenProject.class); mojo.setProject(project); mojo.setLog(Mockito.mock(Log.class)); final String license = "file:./some-file.txt"; mojo.setLicense(license); final Context context = Mockito.mock(Context.class); mojo.contextualize(context); mojo.execute(); Mockito.verify(internal).validate(Mockito.any(MavenEnvironment.class)); Mockito.verify(external).validate(Mockito.any(Environment.class)); Mockito.verify(rexternal, Mockito.atLeastOnce()) .validate(Mockito.anyCollection()); }