use of org.infernus.idea.checkstyle.model.ConfigurationLocationFactory in project checkstyle-idea by jshiell.
the class CheckStyleConfigurableTest method buildMockPanel.
private CheckStyleConfigPanel buildMockPanel(final Project mockProject) {
CheckStyleConfigPanel mockPanel = mock(CheckStyleConfigPanel.class);
final SortedSet<ConfigurationLocation> mockLocations = buildMockLocations(mockProject, new ConfigurationLocationFactory());
final PluginConfiguration mockConfigDto = PluginConfigurationBuilder.testInstance("7.1.2").withLocations(mockLocations).withThirdPartyClassPath(Arrays.asList("cp1", "cp2")).withActiveLocation(mockLocations.first()).build();
when(mockPanel.getPluginConfiguration()).thenReturn(mockConfigDto);
return mockPanel;
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocationFactory in project checkstyle-idea by jshiell.
the class CheckStyleConfigurableTest method mockPluginConfigurationManager.
private PluginConfigurationManager mockPluginConfigurationManager(@NotNull final Project project) {
final ConfigurationLocationFactory mockLocFactory = new ConfigurationLocationFactory();
final SortedSet<ConfigurationLocation> mockLocations = buildMockLocations(project, mockLocFactory);
final PluginConfiguration mockConfigDto = PluginConfigurationBuilder.testInstance("7.1.2").withLocations(mockLocations).withThirdPartyClassPath(Arrays.asList("cp1", "cp2")).withActiveLocation(mockLocations.first()).build();
PluginConfigurationManager mockConfig = mock(PluginConfigurationManager.class);
when(mockConfig.getCurrent()).thenReturn(mockConfigDto);
return mockConfig;
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocationFactory in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method testLoadBundledSunChecks.
@Test
public void testLoadBundledSunChecks() {
final ConfigurationLocationFactory clf = new ConfigurationLocationFactory();
CheckstyleProjectService projectService = mock(CheckstyleProjectService.class);
when(projectService.underlyingClassLoader()).thenReturn(getClass().getClassLoader());
CheckstyleInternalObject csConfig = new CheckstyleActionsImpl(PROJECT, projectService).loadConfiguration(clf.create(BundledConfig.SUN_CHECKS, mock(Project.class)), true, null);
Assert.assertNotNull(csConfig);
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocationFactory in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method testLoadBundledGoogleChecks.
@Test
public void testLoadBundledGoogleChecks() {
final ConfigurationLocationFactory clf = new ConfigurationLocationFactory();
CheckstyleProjectService projectService = mock(CheckstyleProjectService.class);
when(projectService.underlyingClassLoader()).thenReturn(getClass().getClassLoader());
CheckstyleInternalObject csConfig = new CheckstyleActionsImpl(PROJECT, projectService).loadConfiguration(clf.create(BundledConfig.GOOGLE_CHECKS, mock(Project.class)), true, null);
Assert.assertNotNull(csConfig);
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocationFactory 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