Search in sources :

Example 1 with CheckstyleActionsImpl

use of org.infernus.idea.checkstyle.service.CheckstyleActionsImpl in project checkstyle-idea by jshiell.

the class OpCreateCheckerTest method testCreateChecker_noConfigLoc.

@Test(expected = CheckStylePluginException.class)
public void testCreateChecker_noConfigLoc() {
    // noinspection ConstantConditions
    new CheckstyleActionsImpl(PROJECT, checkstyleProjectServiceMock).createChecker(moduleMock, null, emptyMap(), configurationsMock, getClass().getClassLoader());
    fail("expected exception was not thrown");
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) Test(org.junit.Test)

Example 2 with CheckstyleActionsImpl

use of org.infernus.idea.checkstyle.service.CheckstyleActionsImpl in project checkstyle-idea by jshiell.

the class OpCreateCheckerTest method testCreateCheckerWithConfigsMock.

@Test
public void testCreateCheckerWithConfigsMock() throws IOException, URISyntaxException {
    final ConfigurationLocation configLoc = new StringConfigurationLocation(FileUtil.readFile("cmd/" + CONFIG_FILE), mock(Project.class));
    final CheckStyleChecker checker = new CheckstyleActionsImpl(PROJECT, checkstyleProjectServiceMock).createChecker(moduleMock, configLoc, emptyMap(), configurationsMock, getClass().getClassLoader());
    assertNotNull(checker);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) Project(com.intellij.openapi.project.Project) CheckStyleChecker(org.infernus.idea.checkstyle.checker.CheckStyleChecker) ConfigurationLocation(org.infernus.idea.checkstyle.model.ConfigurationLocation) StringConfigurationLocation(org.infernus.idea.checkstyle.service.StringConfigurationLocation) StringConfigurationLocation(org.infernus.idea.checkstyle.service.StringConfigurationLocation) Test(org.junit.Test)

Example 3 with CheckstyleActionsImpl

use of org.infernus.idea.checkstyle.service.CheckstyleActionsImpl in project checkstyle-idea by jshiell.

the class OpCreateCheckerTest method testCreateChecker_noModule.

@Test
public void testCreateChecker_noModule() throws IOException, URISyntaxException {
    final ConfigurationLocation configLoc = new StringConfigurationLocation(FileUtil.readFile("cmd/" + CONFIG_FILE), mock(Project.class));
    // noinspection ConstantConditions
    CheckStyleChecker checker = new CheckstyleActionsImpl(PROJECT, checkstyleProjectServiceMock).createChecker(null, configLoc, emptyMap(), configurationsMock, getClass().getClassLoader());
    assertNotNull(checker);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) Project(com.intellij.openapi.project.Project) CheckStyleChecker(org.infernus.idea.checkstyle.checker.CheckStyleChecker) ConfigurationLocation(org.infernus.idea.checkstyle.model.ConfigurationLocation) StringConfigurationLocation(org.infernus.idea.checkstyle.service.StringConfigurationLocation) StringConfigurationLocation(org.infernus.idea.checkstyle.service.StringConfigurationLocation) Test(org.junit.Test)

Example 4 with CheckstyleActionsImpl

use of org.infernus.idea.checkstyle.service.CheckstyleActionsImpl in project checkstyle-idea by jshiell.

the class OpDestroyCheckerTest method testDestroyChecker.

@Test
public void testDestroyChecker() {
    CheckerWithConfig checkerWithConfig = new CheckerWithConfig(new Checker(), new DefaultConfiguration("testConfig"));
    new CheckstyleActionsImpl(PROJECT, mock(CheckstyleProjectService.class)).destroyChecker(checkerWithConfig);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) Checker(com.puppycrawl.tools.checkstyle.Checker) CheckerWithConfig(org.infernus.idea.checkstyle.service.entities.CheckerWithConfig) DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) Test(org.junit.Test)

Example 5 with CheckstyleActionsImpl

use of org.infernus.idea.checkstyle.service.CheckstyleActionsImpl 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);
}
Also used : CheckstyleActionsImpl(org.infernus.idea.checkstyle.service.CheckstyleActionsImpl) ConfigurationLocationFactory(org.infernus.idea.checkstyle.model.ConfigurationLocationFactory) CheckstyleInternalObject(org.infernus.idea.checkstyle.csapi.CheckstyleInternalObject) CheckstyleProjectService(org.infernus.idea.checkstyle.CheckstyleProjectService) Test(org.junit.Test)

Aggregations

CheckstyleActionsImpl (org.infernus.idea.checkstyle.service.CheckstyleActionsImpl)7 Test (org.junit.Test)7 CheckstyleProjectService (org.infernus.idea.checkstyle.CheckstyleProjectService)3 CheckstyleInternalObject (org.infernus.idea.checkstyle.csapi.CheckstyleInternalObject)3 Project (com.intellij.openapi.project.Project)2 CheckStyleChecker (org.infernus.idea.checkstyle.checker.CheckStyleChecker)2 ConfigurationLocation (org.infernus.idea.checkstyle.model.ConfigurationLocation)2 ConfigurationLocationFactory (org.infernus.idea.checkstyle.model.ConfigurationLocationFactory)2 StringConfigurationLocation (org.infernus.idea.checkstyle.service.StringConfigurationLocation)2 Checker (com.puppycrawl.tools.checkstyle.Checker)1 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)1 CheckerWithConfig (org.infernus.idea.checkstyle.service.entities.CheckerWithConfig)1