aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java
diff options
context:
space:
mode:
authorEvgeny Mandrikov <mandrikov@gmail.com>2011-03-16 13:01:32 +0300
committerEvgeny Mandrikov <mandrikov@gmail.com>2011-03-16 14:46:46 +0300
commitbe5def62257b64e1c7ce9d722dfdf73e887a3b3d (patch)
tree75671a2938de305d1d472bd15daae7edd0affd3d /sonar-plugin-api/src/test/java
parent0f8881badc19b55a3cacd5aa0e6530b87a4bf2b6 (diff)
downloadsonarqube-be5def62257b64e1c7ce9d722dfdf73e887a3b3d.tar.gz
sonarqube-be5def62257b64e1c7ce9d722dfdf73e887a3b3d.zip
SONAR-2280 ProjectFileSystem.resolvePath should return canonical file
Diffstat (limited to 'sonar-plugin-api/src/test/java')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java
index a32c84bc3dd..72e88d2979e 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/DefaultProjectFileSystemTest.java
@@ -19,8 +19,17 @@
*/
package org.sonar.api.resources;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.SystemUtils;
+import org.apache.maven.project.MavenProject;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@@ -32,11 +41,6 @@ import org.sonar.api.test.MavenTestUtils;
import java.io.File;
import java.util.List;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-
public class DefaultProjectFileSystemTest {
private Project project = null;
@@ -144,6 +148,20 @@ public class DefaultProjectFileSystemTest {
}
/**
+ * See http://jira.codehaus.org/browse/SONAR-2280
+ */
+ @Test
+ public void resolvePathShouldReturnCanonicalFile() {
+ MavenProject pom = mock(MavenProject.class);
+ when(pom.getBasedir()).thenReturn(new File("/project"));
+ Project project = new Project("").setPom(pom);
+ DefaultProjectFileSystem fs = new DefaultProjectFileSystem(project, null);
+
+ assertThat(fs.resolvePath(".").getAbsolutePath(), endsWith("project"));
+ assertThat(fs.resolvePath("../project").getAbsolutePath(), endsWith("project"));
+ }
+
+ /**
* Example of hidden files/directories : .DSStore, .svn, .git
*/
@Test