Search in sources :

Example 1 with ProjectPaths

use of org.infernus.idea.checkstyle.util.ProjectPaths in project checkstyle-idea by jshiell.

the class RelativeFileConfigurationLocationTest method setUp.

@Before
public void setUp() {
    ProjectPaths projectPaths = mock(ProjectPaths.class);
    Function<File, String> absolutePathOf = file -> {
        // a nasty hack to pretend we're on a Windows box when required...
        if (file.getPath().startsWith("c:")) {
            return file.getPath().replace('/', '\\').replaceAll("\\\\\\\\", "\\\\");
        }
        return FilenameUtils.separatorsToUnix(file.getPath());
    };
    ProjectFilePaths testProjectFilePaths = new ProjectFilePaths(project, '/', absolutePathOf, projectPaths);
    when(project.getService(ProjectFilePaths.class)).thenReturn(testProjectFilePaths);
    when(projectBase.getPath()).thenReturn(PROJECT_BASE_PATH);
    when(projectPaths.projectPath(project)).thenReturn(projectBase);
    underTest = new RelativeFileConfigurationLocation(project);
    underTest.setLocation("aLocation");
    underTest.setDescription("aDescription");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) ProjectPaths(org.infernus.idea.checkstyle.util.ProjectPaths) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Function(java.util.function.Function) File(java.io.File) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Project(com.intellij.openapi.project.Project) Matchers.is(org.hamcrest.Matchers.is) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) FilenameUtils(org.apache.commons.io.FilenameUtils) ProjectFilePaths(org.infernus.idea.checkstyle.util.ProjectFilePaths) Before(org.junit.Before) Mockito.mock(org.mockito.Mockito.mock) ProjectPaths(org.infernus.idea.checkstyle.util.ProjectPaths) ProjectFilePaths(org.infernus.idea.checkstyle.util.ProjectFilePaths) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Before(org.junit.Before)

Aggregations

Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 Function (java.util.function.Function)1 FilenameUtils (org.apache.commons.io.FilenameUtils)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Matchers.equalTo (org.hamcrest.Matchers.equalTo)1 Matchers.is (org.hamcrest.Matchers.is)1 ProjectFilePaths (org.infernus.idea.checkstyle.util.ProjectFilePaths)1 ProjectPaths (org.infernus.idea.checkstyle.util.ProjectPaths)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 Mock (org.mockito.Mock)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.when (org.mockito.Mockito.when)1 MockitoJUnitRunner (org.mockito.junit.MockitoJUnitRunner)1