use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method setUp.
@Before
public void setUp() throws IOException {
interceptApplicationNotifications();
final ClassLoader checkstyleClassloader = new URLClassLoader(new URL[] {});
final CheckstyleProjectService checkstyleProjectService = mock(CheckstyleProjectService.class);
when(checkstyleProjectService.underlyingClassLoader()).thenReturn(checkstyleClassloader);
when(configurationLocation.resolveAssociatedFile("aFileToResolve", module, checkstyleClassloader)).thenReturn("aResolvedFile");
when(configurationLocation.resolveAssociatedFile("triggersAnIoException", module, checkstyleClassloader)).thenThrow(new IOException("aTriggeredIoException"));
underTest = new OpLoadConfiguration(configurationLocation, null, module, checkstyleProjectService);
}
use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method testConstructors.
@Test
public void testConstructors() {
final CheckstyleProjectService checkstyleProjectService = mock(CheckstyleProjectService.class);
new OpLoadConfiguration(configurationLocation, checkstyleProjectService);
new OpLoadConfiguration(configurationLocation, null, checkstyleProjectService);
new OpLoadConfiguration(configurationLocation, null, module, checkstyleProjectService);
VirtualFile virtualFile = mock(VirtualFile.class);
new OpLoadConfiguration(virtualFile, checkstyleProjectService);
new OpLoadConfiguration(virtualFile, null, checkstyleProjectService);
new OpLoadConfiguration("doesn't matter", checkstyleProjectService);
}
use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.
the class ServiceLayerBasicTest method setUp.
@BeforeClass
public static void setUp() {
PluginConfigurationManager mockPluginConfig = mock(PluginConfigurationManager.class);
final PluginConfiguration mockConfigDto = PluginConfigurationBuilder.testInstance(currentCsVersion()).build();
when(mockPluginConfig.getCurrent()).thenReturn(mockConfigDto);
when(PROJECT.getService(PluginConfigurationManager.class)).thenReturn(mockPluginConfig);
checkstyleProjectService = new CheckstyleProjectService(PROJECT);
}
use of org.infernus.idea.checkstyle.CheckstyleProjectService in project checkstyle-idea by jshiell.
the class OpLoadConfigurationTest method testNoConfiguration.
@Test
public void testNoConfiguration() {
CheckstyleProjectService projectService = mock(CheckstyleProjectService.class);
when(projectService.underlyingClassLoader()).thenReturn(getClass().getClassLoader());
OpLoadConfiguration testee = new OpLoadConfiguration(configurationLocation, null, module, projectService) {
@Override
Configuration callLoadConfiguration(final InputStream inputStream) {
return null;
}
};
try {
testee.execute(PROJECT);
} catch (CheckstyleException e) {
assertTrue(e.getMessage().contains("Couldn't find root module"));
}
}
use of org.infernus.idea.checkstyle.CheckstyleProjectService 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);
}
Aggregations