From d6693ffe167bb5d92aaddbd28ff3780a7494f54d Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Thu, 7 Apr 2011 01:02:25 +0400 Subject: Improve ProjectFileSystem * Use ProjectFileSystem instead of DefaultProjectFileSystem in tests * Use InputFileUtils in DefaultProjectFileSystem * Add MavenProjectFileSystem --- .../java/org/sonar/plugins/cobertura/api/CoberturaUtilsTest.java | 6 +++--- .../test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java | 4 ++-- .../test/java/org/sonar/plugins/pmd/PmdViolationsXmlParserTest.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/sonar-cobertura-plugin/src/test/java/org/sonar/plugins/cobertura/api/CoberturaUtilsTest.java b/plugins/sonar-cobertura-plugin/src/test/java/org/sonar/plugins/cobertura/api/CoberturaUtilsTest.java index 59192a3a258..90a288e058f 100644 --- a/plugins/sonar-cobertura-plugin/src/test/java/org/sonar/plugins/cobertura/api/CoberturaUtilsTest.java +++ b/plugins/sonar-cobertura-plugin/src/test/java/org/sonar/plugins/cobertura/api/CoberturaUtilsTest.java @@ -27,7 +27,7 @@ import static org.mockito.Mockito.when; import org.apache.maven.project.MavenProject; import org.junit.Test; import org.sonar.api.CoreProperties; -import org.sonar.api.resources.DefaultProjectFileSystem; +import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.resources.Project; import org.sonar.api.test.MavenTestUtils; @@ -37,7 +37,7 @@ import java.net.URISyntaxException; public class CoberturaUtilsTest { @Test public void shouldGetReportPathFromProperty() throws URISyntaxException { - DefaultProjectFileSystem fileSystem = mock(DefaultProjectFileSystem.class); + ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); when(fileSystem.resolvePath("foo")).thenReturn(getCoverageReport()); Project project = mock(Project.class); @@ -53,7 +53,7 @@ public class CoberturaUtilsTest { public void shouldGetReportPathFromPom() { MavenProject pom = MavenTestUtils.loadPom("/org/sonar/plugins/cobertura/CoberturaSensorTest/shouldGetReportPathFromPom/pom.xml"); - DefaultProjectFileSystem fileSystem = mock(DefaultProjectFileSystem.class); + ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); Project project = mock(Project.class); when(project.getPom()).thenReturn(pom); diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java index 149ec5daeaf..c4f0d70b9f0 100644 --- a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java +++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.sonar.api.CoreProperties; import org.sonar.api.batch.SensorContext; import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.DefaultProjectFileSystem; +import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.resources.JavaFile; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; @@ -147,7 +147,7 @@ public class FindbugsSensorTest extends FindbugsTests { } private Project createProject() { - DefaultProjectFileSystem fileSystem = mock(DefaultProjectFileSystem.class); + ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); when(fileSystem.hasJavaSourceFiles()).thenReturn(Boolean.TRUE); Project project = mock(Project.class); diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationsXmlParserTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationsXmlParserTest.java index 5286fcd3df8..4d6a4a0e73f 100644 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationsXmlParserTest.java +++ b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationsXmlParserTest.java @@ -39,7 +39,7 @@ import org.junit.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.DefaultProjectFileSystem; +import org.sonar.api.resources.ProjectFileSystem; import org.sonar.api.resources.JavaFile; import org.sonar.api.resources.Project; import org.sonar.api.rules.Rule; @@ -50,7 +50,7 @@ import org.sonar.api.test.IsViolation; public class PmdViolationsXmlParserTest { private void parse(SensorContext context, String xmlPath) throws URISyntaxException, XMLStreamException { - DefaultProjectFileSystem fileSystem = mock(DefaultProjectFileSystem.class); + ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); when(fileSystem.getSourceDirs()).thenReturn(Arrays.asList(new File("/test/src/main/java"))); Project project = mock(Project.class); -- cgit v1.2.3