use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class VersionMixExceptionTest method createChecker.
private CheckStyleChecker createChecker(@NotNull final Module pModule) throws URISyntaxException, IOException {
final ConfigurationLocation configLoc = new StringConfigurationLocation(readFile(CONFIG_FILE), mock(Project.class));
final TabWidthAndBaseDirProvider configurations = mock(TabWidthAndBaseDirProvider.class);
when(configurations.tabWidth()).thenReturn(2);
final String baseDir = new File(getClass().getResource(CONFIG_FILE).toURI()).getParent();
when(configurations.baseDir()).thenReturn(Optional.of(baseDir));
return csService.getCheckstyleInstance().createChecker(pModule, configLoc, Collections.emptyMap(), configurations, getClass().getClassLoader());
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class CheckstylePluginApiTest method currentConfigurationCanBeVisited.
@Test
public void currentConfigurationCanBeVisited() {
BundledConfigurationLocation googleChecks = new ConfigurationLocationFactory().create(GOOGLE_CHECKS, project);
TreeSet<ConfigurationLocation> locations = new TreeSet<>();
locations.add(googleChecks);
when(pluginConfigManager.getCurrent()).thenReturn(PluginConfigurationBuilder.testInstance(CHECKSTYLE_VERSION).withLocations(locations).withActiveLocation(googleChecks).build());
CheckstylePluginApi.ConfigurationVisitor visitor = mock(CheckstylePluginApi.ConfigurationVisitor.class);
underTest.visitCurrentConfiguration(visitor);
ArgumentCaptor<ConfigurationModule> configModuleCaptor = ArgumentCaptor.forClass(ConfigurationModule.class);
verify(visitor, times(58)).accept(eq("Google Checks"), configModuleCaptor.capture());
assertThat(configModuleCaptor.getValue(), is(not(nullValue())));
assertThat(configModuleCaptor.getValue().getName(), is("CommentsIndentation"));
}
Aggregations